diff --git a/config.c b/config.c index c5e8846..89cb01a 100644 --- a/config.c +++ b/config.c @@ -48,6 +48,6 @@ const char *lookupSounds(char input) { } } - return "false"; + return ""; } diff --git a/csoundbox.c b/csoundbox.c index 38571cf..3fe2f7c 100644 --- a/csoundbox.c +++ b/csoundbox.c @@ -9,22 +9,39 @@ #define BITS 8 -int main(int argc, char *argv[]) -{ +int main(int argc, char *argv[]) { cfginit(); - playSound(lookupSounds('a')); - char input; + + inputLocal(); + cfgdestroy(); + return 0; +} + +void inputLocal(void) { initscr(); nonl(); //no newline + noecho(); keypad(stdscr, FALSE); //Disable the F1-12 keypad curs_set(0); //Disable the cursor + + printCursesWelcome(); + + char input; while ((input = getch()) != 13) { playSound(lookupSounds(input)); } 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) { diff --git a/csoundbox.h b/csoundbox.h index fc99fff..b26edb6 100644 --- a/csoundbox.h +++ b/csoundbox.h @@ -1,2 +1,4 @@ void playSound(const char *path); +void inputLocal(void); +void printCursesWelcome(void);