v2 / examples / gg / expanding_rect.v
14 lines · 13 sloc · 274 bytes · a2010130adc4204e6eacf358480fb9e7a2b3dfd7
Raw
1import gg
2
3mut r := &gg.Rect{20, 20, 60, 20}
4gg.start(
5 update_fn: fn [mut r] (dt f32, c &gg.Context) {
6 r.width++
7 r.height++
8 }
9 frame_fn: fn [mut r] (c &gg.Context) {
10 c.begin()
11 c.draw_rect_filled(r.x, r.y, r.width, r.height, gg.frgb(0.0, 0.4, 0.4))
12 c.end()
13 }
14)
15