1 | module main |
2 | |
3 | import gg |
4 | import gx |
5 | |
6 | const ( |
7 | points = [f32(200.0), 200.0, 200.0, 100.0, 400.0, 100.0, 400.0, 300.0] |
8 | ) |
9 | |
10 | struct App { |
11 | mut: |
12 | gg &gg.Context = unsafe { nil } |
13 | } |
14 | |
15 | fn 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 | |
30 | fn frame(mut app App) { |
31 | app.gg.begin() |
32 | app.gg.draw_cubic_bezier(points, gx.blue) |
33 | app.gg.end() |
34 | } |