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
/
sounds.cbas
100 lines (78 loc) · 1.93 KB
/
sounds.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
#include "funbas.hbas"
byte* ourFont = 0;
byte* sound1= 0;
byte* sound2= 0;
byte* sound3= 0;
byte* music1 = 0;
byte* music2 = 0;
fn appInit:
openWindow(
"Joy!",
1280,
720
);
setSwapInterval(1); //enable Vsync
ourFont = loadFont(
"fonts/jupiteroid/Bold.ttf",
50
);
sound1 = loadSample("soundfx/Soft Blurp Hit 1 Zube Tube.wav");
sound2 = loadSample("soundfx/Wibble Wobble Spring 1 Zube Tube.wav");
sound3 = loadSample("soundfx/Futuristic Gun Fire Sound 7 Zube Tube.wav");
music1 = loadMusic("music/Study and Relax.mp3");
music2 = loadMusic("music/3 am West End.mp3");
end
fn appUpdate:
clearScreen(0.1,0.1,0.3);
beginUI();
glColor3f(0.8,0.8,1);
renderText("Press W or E to choose music track, Q for silence.\nASD play sounds.", ourFont, 0, 50,50);
endUI();
swapDisplay();
end
fn appClose:
haltMusic();
freeMusic(music1);
freeMusic(music2);
freeSample(sound1);
freeSample(sound2);
freeSample(sound3);
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):
//escape key is universal quit...
if(state == 0 && kc == KEY_ESCAPE)
appClose();
sys_exit(0);
end
if(state == 1 && kc == KEY_Q)
haltMusic();
elif(state == 1 && kc == KEY_W)
haltMusic();
playMusic(music1,-1,3000);
elif(state == 1 && kc == KEY_E)
haltMusic();
playMusic(music2,-1,3000);
elif(state == 1 && kc == KEY_A)
playSample(sound1,0);
elif(state == 1 && kc == KEY_S)
playSample(sound2,0);
elif(state == 1 && kc == KEY_D)
playSample(sound3,0);
end
end
fn onKeyRepeat(int kc, char state):
//do nothing...
end
fn onResize(int w, int h):
glViewport(0,0,w,h);
end
fn onScroll(int x, int y):
//not interested...
end