From 1eae7aeb57f7d2ba9028b0c2d0aa5d65cb7c080e Mon Sep 17 00:00:00 2001 From: "Carl.Kenner" Date: Wed, 8 Apr 2009 12:34:25 +0000 Subject: [PATCH] Added "close" button to main menu. Not being able to get back to the game from the main menu was driving me (and users of snes9x gx) mad. --- source/ngc/menu.cpp | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/source/ngc/menu.cpp b/source/ngc/menu.cpp index efa36a8..b035522 100644 --- a/source/ngc/menu.cpp +++ b/source/ngc/menu.cpp @@ -877,6 +877,8 @@ static int MenuGameSelection() GuiImageData iconSettings(icon_settings_png); GuiImageData btnOutline(button_png); GuiImageData btnOutlineOver(button_over_png); + GuiImageData btnCloseOutline(button_small_png); + GuiImageData btnCloseOutlineOver(button_small_over_png); GuiTrigger trigA; if(GCSettings.WiimoteOrientation) trigA.SetSimpleTrigger(-1, WPAD_BUTTON_2 | WPAD_CLASSIC_BUTTON_A, PAD_BUTTON_A); @@ -903,6 +905,20 @@ static int MenuGameSelection() settingsBtn.SetTrigger(&trigA); settingsBtn.SetEffectGrow(); + GuiText closeBtnTxt("Close", 22, (GXColor){0, 0, 0, 255}); + GuiImage closeBtnImg(&btnCloseOutline); + GuiImage closeBtnImgOver(&btnCloseOutlineOver); + GuiButton closeBtn(btnCloseOutline.GetWidth(), btnCloseOutline.GetHeight()); + closeBtn.SetAlignment(ALIGN_RIGHT, ALIGN_TOP); + closeBtn.SetPosition(-170, 35); + closeBtn.SetLabel(&closeBtnTxt); + closeBtn.SetImage(&closeBtnImg); + closeBtn.SetImageOver(&closeBtnImgOver); + closeBtn.SetSoundOver(&btnSoundOver); + closeBtn.SetSoundClick(&btnSoundClick); + closeBtn.SetTrigger(&trigA); + closeBtn.SetEffectGrow(); + GuiText exitBtnTxt("Exit", 24, (GXColor){0, 0, 0, 255}); GuiImage exitBtnIcon(&iconHome); exitBtnIcon.SetAlignment(ALIGN_LEFT, ALIGN_MIDDLE); @@ -935,6 +951,7 @@ static int MenuGameSelection() mainWindow->Append(&titleTxt); mainWindow->Append(&gameBrowser); mainWindow->Append(&buttonWindow); + mainWindow->Append(&closeBtn); ResumeGui(); while(menu == MENU_NONE) @@ -987,11 +1004,14 @@ static int MenuGameSelection() menu = MENU_SETTINGS; else if(exitBtn.GetState() == STATE_CLICKED) ExitRequested = 1; + else if(closeBtn.GetState() == STATE_CLICKED) + menu = MENU_EXIT; } HaltGui(); mainWindow->Remove(&titleTxt); mainWindow->Remove(&buttonWindow); mainWindow->Remove(&gameBrowser); + mainWindow->Remove(&closeBtn); return menu; }