Add selectionSound to eMenus
This commit is contained in:
parent
b6ff39914f
commit
889194c9ca
Binary file not shown.
11
lib/menu.c
11
lib/menu.c
|
@ -143,7 +143,7 @@ calc_menu ( struct eMenu* menu, int sp_select_button )
|
||||||
{
|
{
|
||||||
spSleep(50000);
|
spSleep(50000);
|
||||||
if ( spGetInput()->button[sp_select_button] )
|
if ( spGetInput()->button[sp_select_button] )
|
||||||
return menu->selection + 1;
|
return menu_select( menu );
|
||||||
else if ( spGetInput()->button[SP_BUTTON_DOWN] )
|
else if ( spGetInput()->button[SP_BUTTON_DOWN] )
|
||||||
menu_select_down( menu );
|
menu_select_down( menu );
|
||||||
else if ( spGetInput()->button[SP_BUTTON_UP] )
|
else if ( spGetInput()->button[SP_BUTTON_UP] )
|
||||||
|
@ -154,6 +154,15 @@ calc_menu ( struct eMenu* menu, int sp_select_button )
|
||||||
}
|
}
|
||||||
|
|
||||||
// -------------------------------------------------------------------
|
// -------------------------------------------------------------------
|
||||||
|
// returns selected menu item, and plays proper sound
|
||||||
|
int
|
||||||
|
menu_select ( struct eMenu* menu )
|
||||||
|
{
|
||||||
|
if ( menu->moveSound != NULL )
|
||||||
|
spSoundPlay( menu->selectSound, menu->soundChannel,0,0,-1 );
|
||||||
|
return menu->selection + 1;
|
||||||
|
}
|
||||||
|
|
||||||
// move an eMenu's selected element up by one (if possible)
|
// move an eMenu's selected element up by one (if possible)
|
||||||
void
|
void
|
||||||
menu_select_up ( struct eMenu* menu )
|
menu_select_up ( struct eMenu* menu )
|
||||||
|
|
|
@ -51,6 +51,7 @@ int calc_menu ( struct eMenu*, int );
|
||||||
|
|
||||||
void resize_menu ( struct eMenu* );
|
void resize_menu ( struct eMenu* );
|
||||||
|
|
||||||
|
int menu_select ( struct eMenu* );
|
||||||
void menu_select_up ( struct eMenu* );
|
void menu_select_up ( struct eMenu* );
|
||||||
void menu_select_down ( struct eMenu* );
|
void menu_select_down ( struct eMenu* );
|
||||||
|
|
||||||
|
|
|
@ -65,6 +65,9 @@ calc_test ( Uint32 steps )
|
||||||
else
|
else
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
if ( menucode > 0 )
|
||||||
|
spSleep(700000);
|
||||||
|
// sleep long enough after selection to play selection sound lol
|
||||||
return menucode;
|
return menucode;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -98,6 +101,7 @@ init_test_menu ( struct eMenu* menu )
|
||||||
menu->titleCentered = 0;
|
menu->titleCentered = 0;
|
||||||
menu->textCentered = 0;
|
menu->textCentered = 0;
|
||||||
menu->moveSound = sounds[0];
|
menu->moveSound = sounds[0];
|
||||||
|
menu->selectSound = sounds[1];
|
||||||
add_menu_element(menu, "give up");
|
add_menu_element(menu, "give up");
|
||||||
add_menu_element(menu, "run away");
|
add_menu_element(menu, "run away");
|
||||||
add_menu_element(menu, "eat a baby");
|
add_menu_element(menu, "eat a baby");
|
||||||
|
@ -128,6 +132,7 @@ init_sounds ( void )
|
||||||
{
|
{
|
||||||
spSoundInit();
|
spSoundInit();
|
||||||
add_sound("data/sound/tamborine.ogg");
|
add_sound("data/sound/tamborine.ogg");
|
||||||
|
add_sound("data/sound/eeuh.ogg");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Reference in New Issue