@@ -2,32 +2,27 @@ module main
22
33import gg
44
5- fn main() {
6- mut context := gg.new_context(
7- width: 325
8- height: 275
9- window_title: 'Rounded Rectangles'
10- frame_fn: frame
11- )
12- context.run()
13- }
14-
15- fn frame(mut ctx gg.Context) {
16- ctx.begin()
17- // these should be rounded rectangles
18- ctx.draw_rounded_rect_empty(10, 10, 50, 100, 5, gg.blue)
19- ctx.draw_rounded_rect_empty(25, 25, 50, 100, 15, gg.yellow)
20- ctx.draw_rounded_rect_empty(50, 50, 50, 100, 50, gg.red)
21- ctx.draw_rounded_rect_empty(75, 75, 50, 100, 100, gg.green)
22- ctx.draw_rounded_rect_empty(100, 100, 50, 100, 1000, gg.white)
23- ctx.draw_rounded_rect_empty(110, 10, 100, 50, 5, gg.blue)
24- ctx.draw_rounded_rect_empty(125, 25, 100, 50, 15, gg.yellow)
25- ctx.draw_rounded_rect_empty(150, 50, 100, 50, 50, gg.red)
26- ctx.draw_rounded_rect_empty(175, 75, 100, 50, 100, gg.green)
27- ctx.draw_rounded_rect_empty(200, 100, 100, 50, 1000, gg.white)
28- // this should be a perfect circle
29- ctx.draw_rounded_rect_empty(10, 200, 50, 50, 1000, gg.magenta)
30- // this should be a perfect square
31- ctx.draw_rounded_rect_empty(250, 200, 50, 50, 0, gg.cyan)
32- ctx.end()
33- }
5+ gg.start(
6+ width: 325
7+ height: 275
8+ window_title: 'Rounded Rectangles'
9+ frame_fn: fn (mut ctx gg.Context) {
10+ ctx.begin()
11+ // these should be rounded rectangles
12+ ctx.draw_rounded_rect_empty(10, 10, 50, 100, 5, gg.blue)
13+ ctx.draw_rounded_rect_empty(25, 25, 50, 100, 15, gg.yellow)
14+ ctx.draw_rounded_rect_empty(50, 50, 50, 100, 50, gg.red)
15+ ctx.draw_rounded_rect_empty(75, 75, 50, 100, 100, gg.green)
16+ ctx.draw_rounded_rect_empty(100, 100, 50, 100, 1000, gg.white)
17+ ctx.draw_rounded_rect_empty(110, 10, 100, 50, 5, gg.blue)
18+ ctx.draw_rounded_rect_empty(125, 25, 100, 50, 15, gg.yellow)
19+ ctx.draw_rounded_rect_empty(150, 50, 100, 50, 50, gg.red)
20+ ctx.draw_rounded_rect_empty(175, 75, 100, 50, 100, gg.green)
21+ ctx.draw_rounded_rect_empty(200, 100, 100, 50, 1000, gg.white)
22+ // this should be a perfect circle
23+ ctx.draw_rounded_rect_empty(10, 200, 50, 50, 1000, gg.magenta)
24+ // this should be a perfect square
25+ ctx.draw_rounded_rect_empty(250, 200, 50, 50, 0, gg.cyan)
26+ ctx.end()
27+ }
28+ )
0 commit comments