v2 / vlib / gg / testdata / draw_text.vv
45 lines · 43 sloc · 1.1 KB · 67ac570d4bf076d1936cc98ec0683b257393d2c8
Raw
1module main
2
3import gg
4
5gg.start(
6 width: 640
7 height: 300
8 window_title: 'Circles'
9 frame_fn: fn (mut ctx gg.Context) {
10 ctx.begin()
11 ctx.draw_text(10, 10, 'This text is at x: 10, y: 10', gg.TextCfg{ color: gg.white, size: 20 })
12 ctx.draw_text(10, 40, 'This text is at x: 10, y: 40 and bold', gg.TextCfg{
13 color: gg.white
14 bold: true
15 size: 20
16 })
17 ctx.draw_text(10, 70, 'This text is at x: 10, y: 70 and italic', gg.TextCfg{
18 color: gg.white
19 size: 20
20 italic: true
21 })
22 ctx.draw_text(10, 100, 'This text is at x: 10, y: 110 and mono', gg.TextCfg{
23 color: gg.white
24 size: 20
25 mono: true
26 })
27 ctx.draw_text(10, 130, 'This text is at x: 10, y: 130 and twice as big', gg.TextCfg{
28 color: gg.white
29 size: 40
30 })
31 ctx.draw_text(10, 180, 'This text is at x: 10, y: 180 and red', gg.TextCfg{
32 color: gg.red
33 size: 20
34 })
35 ctx.draw_text(10, 210, 'This text is at x: 10, y: 210 and blue', gg.TextCfg{
36 color: gg.blue
37 size: 20
38 })
39 ctx.draw_text(10, 240, 'This text is at x: 10, y: 240 and green', gg.TextCfg{
40 color: gg.green
41 size: 20
42 })
43 ctx.end()
44 }
45)
46