Skip to content

Commit 67ac570

Browse files
authored
gg: add draw_text in gg/testdata (#26404)
1 parent d89bb65 commit 67ac570

File tree

1 file changed

+45
-0
lines changed

1 file changed

+45
-0
lines changed

vlib/gg/testdata/draw_text.vv

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
module main
2+
3+
import gg
4+
5+
gg.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+
)

0 commit comments

Comments
 (0)