Skip to content

Commit ecda44e

Browse files
committed
[app-main] Do not play slide SFX if click plays.
1 parent c00d510 commit ecda44e

File tree

2 files changed

+14
-10
lines changed

2 files changed

+14
-10
lines changed

applications/main/modules/app_module.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
#include <ds.h>
99

10-
void MainApp_SlideLeft();
11-
void MainApp_SlideRight();
10+
void MainApp_SlideLeft(GUI_Widget *widget);
11+
void MainApp_SlideRight(GUI_Widget *widget);
1212
void MainApp_Init(App_t *app);
1313
void MainApp_Shutdown(App_t *app);

applications/main/modules/module.c

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -333,17 +333,21 @@ static void *ClockThread(void *arg) {
333333
* Global functions
334334
*/
335335

336-
void MainApp_SlideLeft() {
336+
void MainApp_SlideLeft(GUI_Widget *widget) {
337337
if(self.cur_x > 0) {
338-
ds_sfx_play(DS_SFX_SLIDE);
338+
if(widget == NULL) {
339+
ds_sfx_play(DS_SFX_SLIDE);
340+
}
339341
self.cur_x -= self.panel_area.w;
340342
GUI_PanelSetXOffset(self.panel, self.cur_x);
341343
}
342344
}
343345

344-
void MainApp_SlideRight() {
346+
void MainApp_SlideRight(GUI_Widget *widget) {
345347
if(self.x > self.cur_x) {
346-
ds_sfx_play(DS_SFX_SLIDE);
348+
if(widget == NULL) {
349+
ds_sfx_play(DS_SFX_SLIDE);
350+
}
347351
self.cur_x += self.panel_area.w;
348352
GUI_PanelSetXOffset(self.panel, self.cur_x);
349353
}
@@ -407,11 +411,11 @@ static void Slide_EventHandler(void *ds_event, void *param, int action) {
407411
case SDL_JOYBUTTONDOWN:
408412
switch(event->jbutton.button) {
409413
case SDL_DC_L:
410-
MainApp_SlideLeft();
414+
MainApp_SlideLeft(NULL);
411415
break;
412416

413417
case SDL_DC_R:
414-
MainApp_SlideRight();
418+
MainApp_SlideRight(NULL);
415419
break;
416420

417421
default:
@@ -423,11 +427,11 @@ static void Slide_EventHandler(void *ds_event, void *param, int action) {
423427
switch (event->key.keysym.sym)
424428
{
425429
case SDLK_COMMA:
426-
MainApp_SlideLeft();
430+
MainApp_SlideLeft(NULL);
427431
break;
428432

429433
case SDLK_PERIOD:
430-
MainApp_SlideRight();
434+
MainApp_SlideRight(NULL);
431435
break;
432436

433437
default:

0 commit comments

Comments
 (0)