v2 / vlib / gg / testdata / draw_rectangles.vv
23 lines · 20 sloc · 578 bytes · bbb61ab3687afe512a1fa12492c876d011626107
Raw
1module main
2
3import gg
4
5gg.start(
6 bg_color: gg.white
7 window_title: 'Rectangles'
8 width: 250
9 height: 100
10 frame_fn: fn (ctx &gg.Context) {
11 ctx.begin()
12 ctx.draw_rect_filled(10, 10, 10, 10, gg.blue)
13 ctx.draw_rect_empty(30, 10, 10, 10, gg.red)
14 ctx.draw_rect_filled(50, 10, 30, 10, gg.green)
15 ctx.draw_rect_empty(100, 10, 30, 10, gg.black)
16
17 ctx.draw_rect_empty(10, 50, 10, 10, gg.blue)
18 ctx.draw_rect_filled(30, 50, 10, 10, gg.red)
19 ctx.draw_rect_empty(50, 50, 30, 10, gg.green)
20 ctx.draw_rect_filled(100, 50, 30, 10, gg.black)
21 ctx.end()
22 }
23)
24