v2 / vlib / gg / testdata / draw_polygons.vv
18 lines · 16 sloc · 472 bytes · 8745ab1ffffc18340ce4ea5c1a37c8fcea130937
Raw
1module main
2
3import gg
4
5gg.start(
6 bg_color: gg.rgb(174, 198, 255)
7 width: 600
8 height: 400
9 window_title: 'Polygons'
10 frame_fn: fn (mut ctx gg.Context) {
11 ctx.begin()
12 ctx.draw_convex_poly([f32(100.0), 100.0, 200.0, 100.0, 300.0, 200.0, 200.0, 300.0, 100.0,
13 300.0], gg.blue)
14 ctx.draw_poly_empty([f32(50.0), 50.0, 70.0, 60.0, 90.0, 80.0, 70.0, 110.0], gg.black)
15 ctx.draw_triangle_filled(450, 142, 530, 280, 370, 280, gg.red)
16 ctx.end()
17 }
18)
19