v / examples / gg
Raw file | 24 loc (21 sloc) | 523 bytes | Latest commit hash 546c388b0
1module main
2
3import gg
4import gx
5
6fn 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
17fn 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}