Local input function
This commit is contained in:
2
config.c
2
config.c
@@ -48,6 +48,6 @@ const char *lookupSounds(char input) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
return "false";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
29
csoundbox.c
29
csoundbox.c
@@ -9,22 +9,39 @@
|
|||||||
#define BITS 8
|
#define BITS 8
|
||||||
|
|
||||||
|
|
||||||
int main(int argc, char *argv[])
|
int main(int argc, char *argv[]) {
|
||||||
{
|
|
||||||
cfginit();
|
cfginit();
|
||||||
playSound(lookupSounds('a'));
|
|
||||||
char input;
|
inputLocal();
|
||||||
|
cfgdestroy();
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
void inputLocal(void) {
|
||||||
initscr();
|
initscr();
|
||||||
nonl(); //no newline
|
nonl(); //no newline
|
||||||
|
noecho();
|
||||||
keypad(stdscr, FALSE); //Disable the F1-12 keypad
|
keypad(stdscr, FALSE); //Disable the F1-12 keypad
|
||||||
curs_set(0); //Disable the cursor
|
curs_set(0); //Disable the cursor
|
||||||
|
|
||||||
|
printCursesWelcome();
|
||||||
|
|
||||||
|
char input;
|
||||||
while ((input = getch()) != 13) {
|
while ((input = getch()) != 13) {
|
||||||
playSound(lookupSounds(input));
|
playSound(lookupSounds(input));
|
||||||
}
|
}
|
||||||
|
|
||||||
endwin();
|
endwin();
|
||||||
cfgdestroy();
|
}
|
||||||
return 0;
|
|
||||||
|
void printCursesWelcome(void) {
|
||||||
|
int y, x;
|
||||||
|
getmaxyx(stdscr, y, x);
|
||||||
|
//center
|
||||||
|
y /= 2;
|
||||||
|
x /= 2;
|
||||||
|
const char *msg = "Press enter to exit.";
|
||||||
|
mvprintw(y, x - (strlen(msg) / 2), msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
void playSound(const char *path) {
|
void playSound(const char *path) {
|
||||||
|
@@ -1,2 +1,4 @@
|
|||||||
|
|
||||||
void playSound(const char *path);
|
void playSound(const char *path);
|
||||||
|
void inputLocal(void);
|
||||||
|
void printCursesWelcome(void);
|
||||||
|
Reference in New Issue
Block a user