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

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