Clear input when pressing Escape.

This commit is contained in:
Steve 2016-03-05 15:35:09 +00:00
parent fe55f2e8ba
commit ac59559d90
6 changed files with 10 additions and 4 deletions

View File

@ -80,7 +80,6 @@ void initChallengeHome(void)
initBackground(); initBackground();
start = getWidget("start", "challenges"); start = getWidget("start", "challenges");
start->enabled = 0;
start->action = startChallengeMission; start->action = startChallengeMission;
getWidget("resume", "challengesMenu")->action = resume; getWidget("resume", "challengesMenu")->action = resume;
@ -168,7 +167,9 @@ static void doChallenges(void)
updateChallengeMissionData(); updateChallengeMissionData();
start->enabled = c->available; start->enabled = 1;
playSound(SND_GUI_CLICK);
} }
app.mouse.button[SDL_BUTTON_LEFT] = 0; app.mouse.button[SDL_BUTTON_LEFT] = 0;
@ -436,7 +437,7 @@ static void handleKeyboard(void)
playSound(SND_GUI_CLOSE); playSound(SND_GUI_CLOSE);
memset(app.keyboard, 0, sizeof(int) * MAX_KEYBOARD_KEYS); clearInput();
} }
} }

View File

@ -59,6 +59,7 @@ extern char *getPlanetTextureName(int n);
extern void playMusic(char *filename); extern void playMusic(char *filename);
extern char *timeToString(long millis, int showHours); extern char *timeToString(long millis, int showHours);
extern char *getChallengeDescription(Challenge *c); extern char *getChallengeDescription(Challenge *c);
extern void clearInput(void);
extern App app; extern App app;
extern Battle battle; extern Battle battle;

View File

@ -615,7 +615,7 @@ static void handleKeyboard(void)
playSound(SND_GUI_CLOSE); playSound(SND_GUI_CLOSE);
memset(app.keyboard, 0, sizeof(int) * MAX_KEYBOARD_KEYS); clearInput();
} }
} }

View File

@ -59,6 +59,7 @@ extern void updateAllMissions(void);
extern StarSystem *getStarSystem(char *name); extern StarSystem *getStarSystem(char *name);
extern void showOKDialog(void (*callback)(void), const char *format, ...); extern void showOKDialog(void (*callback)(void), const char *format, ...);
extern char *getTranslatedString(char *string); extern char *getTranslatedString(char *string);
extern void clearInput(void);
extern App app; extern App app;
extern Colors colors; extern Colors colors;

View File

@ -202,6 +202,8 @@ static void handleKeyboard(void)
{ {
returnFromOptions(); returnFromOptions();
playSound(SND_GUI_CLOSE); playSound(SND_GUI_CLOSE);
clearInput();
} }
} }

View File

@ -55,6 +55,7 @@ extern void initChallengeHome(void);
extern void selectWidget(const char *name, const char *group); extern void selectWidget(const char *name, const char *group);
extern void drawStats(void); extern void drawStats(void);
extern void updateAllMissions(void); extern void updateAllMissions(void);
extern void clearInput(void);
extern App app; extern App app;
extern Battle battle; extern Battle battle;