mirror of
https://github.com/dborth/snes9xgx.git
synced 2024-11-01 00:15:14 +01:00
Add more button triggers for returning from menus (#1030)
This commit is contained in:
parent
446fb15266
commit
1c7e0e43a5
@ -435,7 +435,7 @@ class GuiElement
|
||||
//!Called constantly to redraw the element's tooltip
|
||||
virtual void DrawTooltip();
|
||||
protected:
|
||||
GuiTrigger * trigger[3]; //!< GuiTriggers (input actions) that this element responds to
|
||||
GuiTrigger * trigger[5]; //!< GuiTriggers (input actions) that this element responds to
|
||||
UpdateCallback updateCB; //!< Callback function to call when this element is updated
|
||||
GuiElement * parentElement; //!< Parent element
|
||||
int focus; //!< Element focus (-1 = focus disabled, 0 = not focused, 1 = focused)
|
||||
|
@ -255,7 +255,7 @@ void GuiButton::Update(GuiTrigger * t)
|
||||
if(this->IsClickable())
|
||||
{
|
||||
s32 wm_btns, wm_btns_trig, cc_btns, cc_btns_trig, wiidrc_btns, wiidrc_btns_trig;
|
||||
for(int i=0; i<3; i++)
|
||||
for(int i=0; i<5; i++)
|
||||
{
|
||||
if(trigger[i] && (trigger[i]->chan == -1 || trigger[i]->chan == t->chan))
|
||||
{
|
||||
@ -310,7 +310,7 @@ void GuiButton::Update(GuiTrigger * t)
|
||||
bool held = false;
|
||||
s32 wm_btns, wm_btns_h, wm_btns_trig, cc_btns, cc_btns_h, cc_btns_trig, wiidrc_btns, wiidrc_btns_h, wiidrc_btns_trig;
|
||||
|
||||
for(int i=0; i<3; i++)
|
||||
for(int i=0; i<5; i++)
|
||||
{
|
||||
if(trigger[i] && (trigger[i]->chan == -1 || trigger[i]->chan == t->chan))
|
||||
{
|
||||
|
@ -31,6 +31,8 @@ GuiElement::GuiElement()
|
||||
trigger[0] = NULL;
|
||||
trigger[1] = NULL;
|
||||
trigger[2] = NULL;
|
||||
trigger[3] = NULL;
|
||||
trigger[4] = NULL;
|
||||
parentElement = NULL;
|
||||
rumble = true;
|
||||
selectable = false;
|
||||
@ -362,6 +364,10 @@ void GuiElement::SetTrigger(GuiTrigger * t)
|
||||
trigger[1] = t;
|
||||
else if(!trigger[2])
|
||||
trigger[2] = t;
|
||||
else if(!trigger[3])
|
||||
trigger[3] = t;
|
||||
else if(!trigger[4])
|
||||
trigger[4] = t;
|
||||
else // all were assigned, so we'll just overwrite the first one
|
||||
trigger[0] = t;
|
||||
}
|
||||
|
@ -1382,7 +1382,11 @@ static int MenuGame()
|
||||
GuiImageData batteryBar(battery_bar_png);
|
||||
|
||||
GuiTrigger trigHome;
|
||||
trigHome.SetButtonOnlyTrigger(-1, WPAD_BUTTON_HOME | WPAD_CLASSIC_BUTTON_HOME, 0, WIIDRC_BUTTON_HOME);
|
||||
GuiTrigger trigB;
|
||||
GuiTrigger trig1;
|
||||
trigHome.SetButtonOnlyTrigger(-1, WPAD_BUTTON_HOME | WPAD_CLASSIC_BUTTON_HOME, PAD_BUTTON_START, WIIDRC_BUTTON_HOME);
|
||||
trigB.SetButtonOnlyTrigger(-1, WPAD_BUTTON_B | WPAD_CLASSIC_BUTTON_B, PAD_BUTTON_B, WIIDRC_BUTTON_B);
|
||||
trig1.SetButtonOnlyTrigger(-1, WPAD_BUTTON_1, 0, 0);
|
||||
|
||||
GuiText saveBtnTxt("Save", 22, (GXColor){0, 0, 0, 255});
|
||||
GuiImage saveBtnImg(&btnLargeOutline);
|
||||
@ -1502,6 +1506,8 @@ static int MenuGame()
|
||||
closeBtn.SetTrigger(trigA);
|
||||
closeBtn.SetTrigger(trig2);
|
||||
closeBtn.SetTrigger(&trigHome);
|
||||
closeBtn.SetTrigger(&trigB);
|
||||
closeBtn.SetTrigger(&trig1);
|
||||
closeBtn.SetEffectGrow();
|
||||
|
||||
#ifdef HW_RVL
|
||||
@ -1822,7 +1828,11 @@ static int MenuGameSaves(int action)
|
||||
GuiImageData btnCloseOutlineOver(button_small_over_png);
|
||||
|
||||
GuiTrigger trigHome;
|
||||
trigHome.SetButtonOnlyTrigger(-1, WPAD_BUTTON_HOME | WPAD_CLASSIC_BUTTON_HOME, 0, WIIDRC_BUTTON_HOME);
|
||||
GuiTrigger trigB;
|
||||
GuiTrigger trig1;
|
||||
trigHome.SetButtonOnlyTrigger(-1, WPAD_BUTTON_HOME | WPAD_CLASSIC_BUTTON_HOME, PAD_BUTTON_START, WIIDRC_BUTTON_HOME);
|
||||
trigB.SetButtonOnlyTrigger(-1, WPAD_BUTTON_B | WPAD_CLASSIC_BUTTON_B, PAD_BUTTON_B, WIIDRC_BUTTON_B);
|
||||
trig1.SetButtonOnlyTrigger(-1, WPAD_BUTTON_1, 0, 0);
|
||||
|
||||
GuiText backBtnTxt("Go Back", 22, (GXColor){0, 0, 0, 255});
|
||||
GuiImage backBtnImg(&btnOutline);
|
||||
@ -1837,6 +1847,8 @@ static int MenuGameSaves(int action)
|
||||
backBtn.SetSoundClick(&btnSoundClick);
|
||||
backBtn.SetTrigger(trigA);
|
||||
backBtn.SetTrigger(trig2);
|
||||
backBtn.SetTrigger(&trigB);
|
||||
backBtn.SetTrigger(&trig1);
|
||||
backBtn.SetEffectGrow();
|
||||
|
||||
GuiText closeBtnTxt("Close", 20, (GXColor){0, 0, 0, 255});
|
||||
@ -2094,7 +2106,11 @@ static int MenuGameSettings()
|
||||
GuiImageData btnCloseOutlineOver(button_small_over_png);
|
||||
|
||||
GuiTrigger trigHome;
|
||||
trigHome.SetButtonOnlyTrigger(-1, WPAD_BUTTON_HOME | WPAD_CLASSIC_BUTTON_HOME, 0, WIIDRC_BUTTON_HOME);
|
||||
GuiTrigger trigB;
|
||||
GuiTrigger trig1;
|
||||
trigHome.SetButtonOnlyTrigger(-1, WPAD_BUTTON_HOME | WPAD_CLASSIC_BUTTON_HOME, PAD_BUTTON_START, WIIDRC_BUTTON_HOME);
|
||||
trigB.SetButtonOnlyTrigger(-1, WPAD_BUTTON_B | WPAD_CLASSIC_BUTTON_B, PAD_BUTTON_B, WIIDRC_BUTTON_B);
|
||||
trig1.SetButtonOnlyTrigger(-1, WPAD_BUTTON_1, 0, 0);
|
||||
|
||||
GuiText mappingBtnTxt("Button Mappings", 22, (GXColor){0, 0, 0, 255});
|
||||
mappingBtnTxt.SetWrap(true, btnLargeOutline.GetWidth()-30);
|
||||
@ -2230,6 +2246,8 @@ static int MenuGameSettings()
|
||||
backBtn.SetSoundClick(&btnSoundClick);
|
||||
backBtn.SetTrigger(trigA);
|
||||
backBtn.SetTrigger(trig2);
|
||||
backBtn.SetTrigger(&trigB);
|
||||
backBtn.SetTrigger(&trig1);
|
||||
backBtn.SetEffectGrow();
|
||||
|
||||
HaltGui();
|
||||
@ -2344,6 +2362,11 @@ static int MenuGameCheats()
|
||||
GuiImageData btnOutline(button_png);
|
||||
GuiImageData btnOutlineOver(button_over_png);
|
||||
|
||||
GuiTrigger trigB;
|
||||
GuiTrigger trig1;
|
||||
trigB.SetButtonOnlyTrigger(-1, WPAD_BUTTON_B | WPAD_CLASSIC_BUTTON_B, PAD_BUTTON_B, WIIDRC_BUTTON_B);
|
||||
trig1.SetButtonOnlyTrigger(-1, WPAD_BUTTON_1, 0, 0);
|
||||
|
||||
GuiText backBtnTxt("Go Back", 22, (GXColor){0, 0, 0, 255});
|
||||
GuiImage backBtnImg(&btnOutline);
|
||||
GuiImage backBtnImgOver(&btnOutlineOver);
|
||||
@ -2357,6 +2380,8 @@ static int MenuGameCheats()
|
||||
backBtn.SetSoundClick(&btnSoundClick);
|
||||
backBtn.SetTrigger(trigA);
|
||||
backBtn.SetTrigger(trig2);
|
||||
backBtn.SetTrigger(&trigB);
|
||||
backBtn.SetTrigger(&trig1);
|
||||
backBtn.SetEffectGrow();
|
||||
|
||||
GuiOptionBrowser optionBrowser(552, 248, &options);
|
||||
@ -2418,6 +2443,11 @@ static int MenuSettingsMappings()
|
||||
GuiImageData iconJustifier(icon_settings_justifier_png);
|
||||
GuiImageData iconMouse(icon_settings_mouse_png);
|
||||
|
||||
GuiTrigger trigB;
|
||||
GuiTrigger trig1;
|
||||
trigB.SetButtonOnlyTrigger(-1, WPAD_BUTTON_B | WPAD_CLASSIC_BUTTON_B, PAD_BUTTON_B, WIIDRC_BUTTON_B);
|
||||
trig1.SetButtonOnlyTrigger(-1, WPAD_BUTTON_1, 0, 0);
|
||||
|
||||
GuiText snesBtnTxt("SNES Controller", 22, (GXColor){0, 0, 0, 255});
|
||||
snesBtnTxt.SetWrap(true, btnLargeOutline.GetWidth()-40);
|
||||
GuiImage snesBtnImg(&btnLargeOutline);
|
||||
@ -2517,6 +2547,8 @@ static int MenuSettingsMappings()
|
||||
backBtn.SetSoundClick(&btnSoundClick);
|
||||
backBtn.SetTrigger(trigA);
|
||||
backBtn.SetTrigger(trig2);
|
||||
backBtn.SetTrigger(&trigB);
|
||||
backBtn.SetTrigger(&trig1);
|
||||
backBtn.SetEffectGrow();
|
||||
|
||||
HaltGui();
|
||||
@ -2601,6 +2633,11 @@ static int MenuSettingsMappingsController()
|
||||
GuiImageData iconWiiupro(icon_settings_wiiupro_png);
|
||||
GuiImageData iconDrc(icon_settings_drc_png);
|
||||
|
||||
GuiTrigger trigB;
|
||||
GuiTrigger trig1;
|
||||
trigB.SetButtonOnlyTrigger(-1, WPAD_BUTTON_B | WPAD_CLASSIC_BUTTON_B, PAD_BUTTON_B, WIIDRC_BUTTON_B);
|
||||
trig1.SetButtonOnlyTrigger(-1, WPAD_BUTTON_1, 0, 0);
|
||||
|
||||
GuiText gamecubeBtnTxt("GameCube Controller", 22, (GXColor){0, 0, 0, 255});
|
||||
gamecubeBtnTxt.SetWrap(true, btnLargeOutline.GetWidth()-30);
|
||||
GuiImage gamecubeBtnImg(&btnLargeOutline);
|
||||
@ -2726,6 +2763,8 @@ static int MenuSettingsMappingsController()
|
||||
backBtn.SetSoundClick(&btnSoundClick);
|
||||
backBtn.SetTrigger(trigA);
|
||||
backBtn.SetTrigger(trig2);
|
||||
backBtn.SetTrigger(&trigB);
|
||||
backBtn.SetTrigger(&trig1);
|
||||
backBtn.SetEffectGrow();
|
||||
|
||||
HaltGui();
|
||||
@ -3424,6 +3463,11 @@ static int MenuSettingsOtherMappings()
|
||||
GuiImageData btnOutline(button_png);
|
||||
GuiImageData btnOutlineOver(button_over_png);
|
||||
|
||||
GuiTrigger trigB;
|
||||
GuiTrigger trig1;
|
||||
trigB.SetButtonOnlyTrigger(-1, WPAD_BUTTON_B | WPAD_CLASSIC_BUTTON_B, PAD_BUTTON_B, WIIDRC_BUTTON_B);
|
||||
trig1.SetButtonOnlyTrigger(-1, WPAD_BUTTON_1, 0, 0);
|
||||
|
||||
GuiText backBtnTxt("Go Back", 22, (GXColor){0, 0, 0, 255});
|
||||
GuiImage backBtnImg(&btnOutline);
|
||||
GuiImage backBtnImgOver(&btnOutlineOver);
|
||||
@ -3437,6 +3481,8 @@ static int MenuSettingsOtherMappings()
|
||||
backBtn.SetSoundClick(&btnSoundClick);
|
||||
backBtn.SetTrigger(trigA);
|
||||
backBtn.SetTrigger(trig2);
|
||||
backBtn.SetTrigger(&trigB);
|
||||
backBtn.SetTrigger(&trig1);
|
||||
backBtn.SetEffectGrow();
|
||||
|
||||
GuiOptionBrowser optionBrowser(552, 248, &options);
|
||||
@ -3587,6 +3633,11 @@ static int MenuSettingsVideo()
|
||||
GuiImageData btnOutline(button_png);
|
||||
GuiImageData btnOutlineOver(button_over_png);
|
||||
|
||||
GuiTrigger trigB;
|
||||
GuiTrigger trig1;
|
||||
trigB.SetButtonOnlyTrigger(-1, WPAD_BUTTON_B | WPAD_CLASSIC_BUTTON_B, PAD_BUTTON_B, WIIDRC_BUTTON_B);
|
||||
trig1.SetButtonOnlyTrigger(-1, WPAD_BUTTON_1, 0, 0);
|
||||
|
||||
GuiText backBtnTxt("Go Back", 22, (GXColor){0, 0, 0, 255});
|
||||
GuiImage backBtnImg(&btnOutline);
|
||||
GuiImage backBtnImgOver(&btnOutlineOver);
|
||||
@ -3600,6 +3651,8 @@ static int MenuSettingsVideo()
|
||||
backBtn.SetSoundClick(&btnSoundClick);
|
||||
backBtn.SetTrigger(trigA);
|
||||
backBtn.SetTrigger(trig2);
|
||||
backBtn.SetTrigger(&trigB);
|
||||
backBtn.SetTrigger(&trig1);
|
||||
backBtn.SetEffectGrow();
|
||||
|
||||
GuiOptionBrowser optionBrowser(552, 248, &options);
|
||||
@ -3796,6 +3849,12 @@ static int MenuSettingsAudio()
|
||||
GuiSound btnSoundClick(button_click_pcm, button_click_pcm_size, SOUND_PCM);
|
||||
GuiImageData btnOutline(button_png);
|
||||
GuiImageData btnOutlineOver(button_over_png);
|
||||
|
||||
GuiTrigger trigB;
|
||||
GuiTrigger trig1;
|
||||
trigB.SetButtonOnlyTrigger(-1, WPAD_BUTTON_B | WPAD_CLASSIC_BUTTON_B, PAD_BUTTON_B, WIIDRC_BUTTON_B);
|
||||
trig1.SetButtonOnlyTrigger(-1, WPAD_BUTTON_1, 0, 0);
|
||||
|
||||
GuiText backBtnTxt("Go Back", 22, (GXColor){0, 0, 0, 255});
|
||||
GuiImage backBtnImg(&btnOutline);
|
||||
GuiImage backBtnImgOver(&btnOutlineOver);
|
||||
@ -3809,6 +3868,8 @@ static int MenuSettingsAudio()
|
||||
backBtn.SetSoundClick(&btnSoundClick);
|
||||
backBtn.SetTrigger(trigA);
|
||||
backBtn.SetTrigger(trig2);
|
||||
backBtn.SetTrigger(&trigB);
|
||||
backBtn.SetTrigger(&trig1);
|
||||
backBtn.SetEffectGrow();
|
||||
GuiOptionBrowser optionBrowser(552, 248, &options);
|
||||
optionBrowser.SetPosition(0, 108);
|
||||
@ -3898,6 +3959,11 @@ static int MenuSettings()
|
||||
GuiImageData iconMenu(icon_settings_menu_png);
|
||||
GuiImageData iconNetwork(icon_settings_network_png);
|
||||
|
||||
GuiTrigger trigB;
|
||||
GuiTrigger trig1;
|
||||
trigB.SetButtonOnlyTrigger(-1, WPAD_BUTTON_B | WPAD_CLASSIC_BUTTON_B, PAD_BUTTON_B, WIIDRC_BUTTON_B);
|
||||
trig1.SetButtonOnlyTrigger(-1, WPAD_BUTTON_1, 0, 0);
|
||||
|
||||
GuiText savingBtnTxt1("Saving", 22, (GXColor){0, 0, 0, 255});
|
||||
GuiText savingBtnTxt2("&", 18, (GXColor){0, 0, 0, 255});
|
||||
GuiText savingBtnTxt3("Loading", 22, (GXColor){0, 0, 0, 255});
|
||||
@ -3987,6 +4053,8 @@ static int MenuSettings()
|
||||
backBtn.SetSoundClick(&btnSoundClick);
|
||||
backBtn.SetTrigger(trigA);
|
||||
backBtn.SetTrigger(trig2);
|
||||
backBtn.SetTrigger(&trigB);
|
||||
backBtn.SetTrigger(&trig1);
|
||||
backBtn.SetEffectGrow();
|
||||
|
||||
GuiText resetBtnTxt("Reset Settings", 22, (GXColor){0, 0, 0, 255});
|
||||
@ -4099,6 +4167,11 @@ static int MenuSettingsFile()
|
||||
GuiImageData btnOutline(button_long_png);
|
||||
GuiImageData btnOutlineOver(button_long_over_png);
|
||||
|
||||
GuiTrigger trigB;
|
||||
GuiTrigger trig1;
|
||||
trigB.SetButtonOnlyTrigger(-1, WPAD_BUTTON_B | WPAD_CLASSIC_BUTTON_B, PAD_BUTTON_B, WIIDRC_BUTTON_B);
|
||||
trig1.SetButtonOnlyTrigger(-1, WPAD_BUTTON_1, 0, 0);
|
||||
|
||||
GuiText backBtnTxt("Go Back", 22, (GXColor){0, 0, 0, 255});
|
||||
GuiImage backBtnImg(&btnOutline);
|
||||
GuiImage backBtnImgOver(&btnOutlineOver);
|
||||
@ -4112,6 +4185,8 @@ static int MenuSettingsFile()
|
||||
backBtn.SetSoundClick(&btnSoundClick);
|
||||
backBtn.SetTrigger(trigA);
|
||||
backBtn.SetTrigger(trig2);
|
||||
backBtn.SetTrigger(&trigB);
|
||||
backBtn.SetTrigger(&trig1);
|
||||
backBtn.SetEffectGrow();
|
||||
|
||||
GuiOptionBrowser optionBrowser(552, 248, &options);
|
||||
@ -4317,6 +4392,11 @@ static int MenuSettingsMenu()
|
||||
GuiImageData btnOutline(button_long_png);
|
||||
GuiImageData btnOutlineOver(button_long_over_png);
|
||||
|
||||
GuiTrigger trigB;
|
||||
GuiTrigger trig1;
|
||||
trigB.SetButtonOnlyTrigger(-1, WPAD_BUTTON_B | WPAD_CLASSIC_BUTTON_B, PAD_BUTTON_B, WIIDRC_BUTTON_B);
|
||||
trig1.SetButtonOnlyTrigger(-1, WPAD_BUTTON_1, 0, 0);
|
||||
|
||||
GuiText backBtnTxt("Go Back", 22, (GXColor){0, 0, 0, 255});
|
||||
GuiImage backBtnImg(&btnOutline);
|
||||
GuiImage backBtnImgOver(&btnOutlineOver);
|
||||
@ -4330,6 +4410,8 @@ static int MenuSettingsMenu()
|
||||
backBtn.SetSoundClick(&btnSoundClick);
|
||||
backBtn.SetTrigger(trigA);
|
||||
backBtn.SetTrigger(trig2);
|
||||
backBtn.SetTrigger(&trigB);
|
||||
backBtn.SetTrigger(&trig1);
|
||||
backBtn.SetEffectGrow();
|
||||
|
||||
GuiOptionBrowser optionBrowser(552, 248, &options);
|
||||
@ -4521,6 +4603,11 @@ static int MenuSettingsNetwork()
|
||||
GuiImageData btnOutline(button_long_png);
|
||||
GuiImageData btnOutlineOver(button_long_over_png);
|
||||
|
||||
GuiTrigger trigB;
|
||||
GuiTrigger trig1;
|
||||
trigB.SetButtonOnlyTrigger(-1, WPAD_BUTTON_B | WPAD_CLASSIC_BUTTON_B, PAD_BUTTON_B, WIIDRC_BUTTON_B);
|
||||
trig1.SetButtonOnlyTrigger(-1, WPAD_BUTTON_1, 0, 0);
|
||||
|
||||
GuiText backBtnTxt("Go Back", 22, (GXColor){0, 0, 0, 255});
|
||||
GuiImage backBtnImg(&btnOutline);
|
||||
GuiImage backBtnImgOver(&btnOutlineOver);
|
||||
@ -4534,6 +4621,8 @@ static int MenuSettingsNetwork()
|
||||
backBtn.SetSoundClick(&btnSoundClick);
|
||||
backBtn.SetTrigger(trigA);
|
||||
backBtn.SetTrigger(trig2);
|
||||
backBtn.SetTrigger(&trigB);
|
||||
backBtn.SetTrigger(&trig1);
|
||||
backBtn.SetEffectGrow();
|
||||
|
||||
GuiOptionBrowser optionBrowser(552, 248, &options);
|
||||
|
Loading…
Reference in New Issue
Block a user