1 | module main |
2 | |
3 | import gg |
4 | import gx |
5 | |
6 | fn main() { |
7 | mut context := gg.new_context( |
8 | bg_color: gx.rgb(174, 198, 255) |
9 | width: 600 |
10 | height: 400 |
11 | window_title: 'Polygons' |
12 | frame_fn: frame |
13 | ) |
14 | context.run() |
15 | } |
16 | |
17 | fn frame(mut ctx gg.Context) { |
18 | ctx.begin() |
19 | ctx.draw_convex_poly([f32(100.0), 100.0, 200.0, 100.0, 300.0, 200.0, 200.0, 300.0, 100.0, 300.0], |
20 | gx.blue) |
21 | ctx.draw_poly_empty([f32(50.0), 50.0, 70.0, 60.0, 90.0, 80.0, 70.0, 110.0], gx.black) |
22 | ctx.draw_triangle_filled(450, 142, 530, 280, 370, 280, gx.red) |
23 | ctx.end() |
24 | } |