2021-08-24 06:35:27 +03:00
|
|
|
module main
|
|
|
|
|
|
|
|
import gg
|
|
|
|
import gx
|
|
|
|
|
|
|
|
const (
|
2021-08-27 16:52:05 +03:00
|
|
|
points = [f32(200.0), 200.0, 200.0, 100.0, 400.0, 100.0, 400.0, 300.0]
|
2021-08-24 06:35:27 +03:00
|
|
|
)
|
|
|
|
|
|
|
|
struct App {
|
|
|
|
mut:
|
2022-09-15 07:59:31 +03:00
|
|
|
gg &gg.Context = unsafe { nil }
|
2021-08-24 06:35:27 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
fn main() {
|
|
|
|
mut app := &App{
|
|
|
|
gg: 0
|
|
|
|
}
|
|
|
|
app.gg = gg.new_context(
|
|
|
|
bg_color: gx.rgb(174, 198, 255)
|
|
|
|
width: 600
|
|
|
|
height: 400
|
|
|
|
window_title: 'Cubic Bézier curve'
|
|
|
|
frame_fn: frame
|
|
|
|
user_data: app
|
|
|
|
)
|
|
|
|
app.gg.run()
|
|
|
|
}
|
|
|
|
|
|
|
|
fn frame(mut app App) {
|
|
|
|
app.gg.begin()
|
2021-08-27 16:52:05 +03:00
|
|
|
app.gg.draw_cubic_bezier(points, gx.blue)
|
2021-08-24 06:35:27 +03:00
|
|
|
app.gg.end()
|
|
|
|
}
|