Play menu sounds.

This commit is contained in:
Steve 2018-02-25 12:23:00 +00:00
parent b3e87f8cfb
commit a13e22fb85
6 changed files with 13 additions and 7 deletions

View File

@ -62,6 +62,7 @@ void doStats(void)
{
if (isControl(CONTROL_LEFT) || app.keyboard[SDL_SCANCODE_LEFT])
{
playSound(SND_MENU_NAV, 0);
page = limit(page - 1, 0, maxPages - 1);
app.keyboard[SDL_SCANCODE_LEFT] = 0;
clearControl(CONTROL_LEFT);
@ -69,6 +70,7 @@ void doStats(void)
if (isControl(CONTROL_RIGHT) || app.keyboard[SDL_SCANCODE_RIGHT])
{
playSound(SND_MENU_NAV, 0);
page = limit(page + 1, 0, maxPages - 1);
app.keyboard[SDL_SCANCODE_RIGHT] = 0;
clearControl(CONTROL_RIGHT);

View File

@ -34,6 +34,7 @@ extern Atlas *getImageFromAtlas(char *filename);
extern Texture *getTexture(const char *filename);
extern void blitRect(SDL_Texture *texture, int x, int y, SDL_Rect *srcRect, int center);
extern void doWidgets(void);
extern void playSound(int snd, int ch);
extern App app;
extern Colors colors;

View File

@ -81,6 +81,7 @@ void doTrophies(void)
{
if (isControl(CONTROL_LEFT) || app.keyboard[SDL_SCANCODE_LEFT])
{
playSound(SND_MENU_NAV, 0);
page = limit(page - 1, 0, maxPages - 1);
app.keyboard[SDL_SCANCODE_LEFT] = 0;
clearControl(CONTROL_LEFT);
@ -88,6 +89,7 @@ void doTrophies(void)
if (isControl(CONTROL_RIGHT) || app.keyboard[SDL_SCANCODE_RIGHT])
{
playSound(SND_MENU_NAV, 0);
page = limit(page + 1, 0, maxPages - 1);
app.keyboard[SDL_SCANCODE_RIGHT] = 0;
clearControl(CONTROL_RIGHT);

View File

@ -44,6 +44,7 @@ extern int isControl(int type);
extern void clearControl(int type);
extern void doWidgets(void);
extern char *timeToDate(long millis);
extern void playSound(int snd, int ch);
extern App app;
extern Colors colors;

View File

@ -236,6 +236,7 @@ static void logic(void)
doWidgets();
if (app.keyboard[SDL_SCANCODE_ESCAPE])
{
playSound(SND_MENU_BACK, 0);
showing = SHOW_NONE;
app.keyboard[SDL_SCANCODE_ESCAPE] = 0;
}
@ -245,6 +246,7 @@ static void logic(void)
doStats();
if (app.keyboard[SDL_SCANCODE_ESCAPE])
{
playSound(SND_MENU_BACK, 0);
returnFromTrophyStats();
}
break;
@ -253,6 +255,7 @@ static void logic(void)
doTrophies();
if (app.keyboard[SDL_SCANCODE_ESCAPE])
{
playSound(SND_MENU_BACK, 0);
returnFromTrophyStats();
}
break;
@ -301,6 +304,7 @@ static void doMissionSelect(void)
if (app.keyboard[SDL_SCANCODE_ESCAPE])
{
playSound(SND_MENU_BACK, 0);
showWidgetGroup("hub");
showing = SHOW_WIDGETS;
app.keyboard[SDL_SCANCODE_ESCAPE] = 0;
@ -422,15 +426,9 @@ static void drawInfoBar(void)
static void drawHudWidgets(void)
{
int w, h;
w = 300;
h = 420;
drawRect(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0, 0, 128);
drawRect((SCREEN_WIDTH - w) / 2, (SCREEN_HEIGHT - h) / 2, w, h, 0, 0, 0, 192);
drawOutlineRect((SCREEN_WIDTH - w) / 2, (SCREEN_HEIGHT - h) / 2, w, h, 255, 255, 255, 255);
drawWidgetFrame();
drawWidgets();
}

View File

@ -69,6 +69,8 @@ extern void doTrophies(void);
extern void drawTrophies(void);
extern void initOptions(void (*callback)(void));
extern int getMissionStatus(char *id);
extern void drawWidgetFrame(void);
extern void playSound(int snd, int ch);
extern App app;
extern Colors colors;