v / examples
Raw file | 36 loc (33 sloc) | 606 bytes | Latest commit hash 9e06af8bf
1import term
2
3fn main() {
4 term.erase_clear()
5 sleeping_line(5, 5, 5, '*')
6 standing_line(5, 5, 5, '*')
7 sleeping_line(5, 10, 5, '*')
8 standing_line(9, 5, 5, '*')
9 term.cursor_down(5)
10 print('\n')
11 println(term.bold(term.red('It Worked!')))
12}
13
14fn sleeping_line(x int, y int, size int, ch string) {
15 mut i := 0
16 for i < size {
17 term.set_cursor_position(
18 x: x + i
19 y: y
20 )
21 print(term.bold(term.yellow(ch)))
22 i++
23 }
24}
25
26fn standing_line(x int, y int, size int, ch string) {
27 mut i := 0
28 for i < size {
29 term.set_cursor_position(
30 x: x
31 y: y + i
32 )
33 print(term.bold(term.yellow(ch)))
34 i++
35 }
36}