Local input function

This commit is contained in:
2017-12-13 20:12:16 +01:00
parent edde2c0aec
commit e06f0412ac
3 changed files with 26 additions and 7 deletions

View File

@@ -48,6 +48,6 @@ const char *lookupSounds(char input) {
} }
} }
return "false"; return "";
} }

View File

@@ -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) {

View File

@@ -1,2 +1,4 @@
void playSound(const char *path); void playSound(const char *path);
void inputLocal(void);
void printCursesWelcome(void);