This repository has been archived by the owner on Nov 22, 2023. It is now read-only.
forked from gek169/funbas
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcontrolflow.cbas
116 lines (92 loc) · 2.08 KB
/
controlflow.cbas
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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
#include "funbas.hbas"
byte* ourFont = 0; //the variable used to store our font!
fn appInit():
openWindow(
"Joy!",
1280,
720
);
setSwapInterval(1); //enable Vsync
//load our font! (Must be AFTER openWindow)
ourFont = loadFont(
"fonts/jupiteroid/Bold.ttf",
64
);
end
int keypressed = 0;
uint keypresses = 2;
fn appUpdate():
clearScreen(0.1,0.1,0.3);
beginUI();
glColor3f(0.8,0.8,1);
if(keypressed)
if(keypressed == KEY_H)
renderText(
"You are pressing H!",
ourFont,100,128,64
);
elif(keypressed == KEY_J)
renderText(
"You are pressing J!",
ourFont,100,128,64
);
else
renderText(
"Good!",
ourFont,100,128,64
);
end
else
renderText(
"Try pressing a key.",
ourFont,100,128,64
);
end
//demo switch....
switch(keypresses%3) mod_0, mod_1, mod_2;
:mod_0
renderText(
"Hey...",
ourFont,100,200,64
);
jump after
:mod_1
renderText(
"There!",
ourFont,100,200,64
);
jump after
:mod_2
:after
endUI();
swapDisplay();
end
fn appClose():
free(ourFont);
closeWindow;
end
fn onClick(int btn, int state):
end
fn onTextInput(char* text):
end
fn onTextEdit(char* text, int start, int length):
end
fn onKey(int kc, char state):
if(state == 0 && kc == KEY_ESCAPE)
appClose();
sys_exit(0);
end
if(state == 1)
keypressed = kc;
keypresses++;
elif(keypressed == kc)
keypressed = 0;
end
end
fn onKeyRepeat(int kc, char state):
end
fn onResize(int w, int h):
glViewport(0,0,width,height);
end
fn onScroll(int x, int y):
end