v2 / vlib / gg / testdata / draw_rounded_rect_empty.vv
28 lines · 26 sloc · 1.01 KB · 8745ab1ffffc18340ce4ea5c1a37c8fcea130937
Raw
1module main
2
3import gg
4
5gg.start(
6 width: 325
7 height: 275
8 window_title: 'Rounded Rectangles'
9 frame_fn: fn (mut ctx gg.Context) {
10 ctx.begin()
11 // these should be rounded rectangles
12 ctx.draw_rounded_rect_empty(10, 10, 50, 100, 5, gg.blue)
13 ctx.draw_rounded_rect_empty(25, 25, 50, 100, 15, gg.yellow)
14 ctx.draw_rounded_rect_empty(50, 50, 50, 100, 50, gg.red)
15 ctx.draw_rounded_rect_empty(75, 75, 50, 100, 100, gg.green)
16 ctx.draw_rounded_rect_empty(100, 100, 50, 100, 1000, gg.white)
17 ctx.draw_rounded_rect_empty(110, 10, 100, 50, 5, gg.blue)
18 ctx.draw_rounded_rect_empty(125, 25, 100, 50, 15, gg.yellow)
19 ctx.draw_rounded_rect_empty(150, 50, 100, 50, 50, gg.red)
20 ctx.draw_rounded_rect_empty(175, 75, 100, 50, 100, gg.green)
21 ctx.draw_rounded_rect_empty(200, 100, 100, 50, 1000, gg.white)
22 // this should be a perfect circle
23 ctx.draw_rounded_rect_empty(10, 200, 50, 50, 1000, gg.magenta)
24 // this should be a perfect square
25 ctx.draw_rounded_rect_empty(250, 200, 50, 50, 0, gg.cyan)
26 ctx.end()
27 }
28)
29