aboutsummaryrefslogtreecommitdiff
path: root/v_windows/v/old/examples/terminal_control.v
blob: 404f290c1d41ba44cc6a2f2e40628340439da4f2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
import term

fn main() {
	term.erase_clear()
	sleeping_line(5, 5, 5, '*')
	standing_line(5, 5, 5, '*')
	sleeping_line(5, 10, 5, '*')
	standing_line(9, 5, 5, '*')
	term.cursor_down(5)
	print('\n')
	println(term.bold(term.red('It Worked!')))
}

fn sleeping_line(x int, y int, size int, ch string) {
	mut i := 0
	for i < size {
		term.set_cursor_position(
			x: x + i
			y: y
		)
		print(term.bold(term.yellow(ch)))
		i++
	}
}

fn standing_line(x int, y int, size int, ch string) {
	mut i := 0
	for i < size {
		term.set_cursor_position(
			x: x
			y: y + i
		)
		print(term.bold(term.yellow(ch)))
		i++
	}
}