v / examples / gg
Raw file | 34 loc (29 sloc) | 491 bytes | Latest commit hash 8b962f844
1module main
2
3import gg
4import gx
5
6const (
7 points = [f32(200.0), 200.0, 200.0, 100.0, 400.0, 100.0, 400.0, 300.0]
8)
9
10struct App {
11mut:
12 gg &gg.Context = unsafe { nil }
13}
14
15fn main() {
16 mut app := &App{
17 gg: 0
18 }
19 app.gg = gg.new_context(
20 bg_color: gx.rgb(174, 198, 255)
21 width: 600
22 height: 400
23 window_title: 'Cubic Bézier curve'
24 frame_fn: frame
25 user_data: app
26 )
27 app.gg.run()
28}
29
30fn frame(mut app App) {
31 app.gg.begin()
32 app.gg.draw_cubic_bezier(points, gx.blue)
33 app.gg.end()
34}