-
Notifications
You must be signed in to change notification settings - Fork 0
/
tui.qon
51 lines (44 loc) · 1.33 KB
/
tui.qon
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
((includes base.qon )
(types)
(functions
(string newScreen (int size string screen) (declare)
(body
(if (greaterthan size 0)
(then (return (stringConcatenate " " (newScreen (sub1 size) screen))))
(else (return screen))
)))
(string drawAt (string screen int width int height int x int y string text int posInText) (declare)
(body
(if (greaterthan (string-length text) posInText)
(then
(printf "%d, %d, %d pos: %d\n" y width x (add (mult y width) x))
(printf "string length %d\n" (string-length screen))
(printf "text %s\n" (sub_string text posInText 10))
;(setSubString screen 1 "hello")
(printf "worked\n" )
(setSubString screen (add (mult y width) x) (sub_string text posInText 10))
(drawAt screen width height (add1 x) y text (add1 posInText))
)
(else (return screen)))
(return screen)
))
(void printLine (string screen int width int line) (declare)
(body
(printf "%sx\n" (sub_string screen (mult line width) width))
))
(void printScreen (string screen int width int height int line) (declare)
(body
(if (greaterthan height line)
(then
(printLine screen width line)
(printScreen screen width height (add1 line)))
(else (return)))
))
(int start ()
(declare )
(body
; (tron)
(printScreen (drawAt (newScreen 1600 "") 80 20 10 10 "asdfsf" 0) 80 20 0)
(return 0)
))
))