Add a credits button to the Settings screen (#1027)

This commit is contained in:
InfiniteBlueGX 2022-10-09 16:05:01 -05:00 committed by GitHub
parent aa9d1f679e
commit 59b1b4c795
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -89,6 +89,7 @@ static lwp_t guithread = LWP_THREAD_NULL;
static lwp_t progressthread = LWP_THREAD_NULL;
static bool guiHalt = true;
static int showProgress = 0;
static bool showCredits = false;
static char progressTitle[101];
static char progressMsg[201];
@ -800,7 +801,7 @@ SettingWindow(const char * title, GuiWindow * w)
***************************************************************************/
static void WindowCredits(void * ptr)
{
if(btnLogo->GetState() != STATE_CLICKED)
if(btnLogo->GetState() != STATE_CLICKED && !showCredits)
return;
btnLogo->ResetState();
@ -932,6 +933,7 @@ static void WindowCredits(void * ptr)
(userInput[3].wpad->btns_d || userInput[3].pad.btns_d || userInput[3].wiidrcdata.btns_d))
{
exit = true;
showCredits = false;
}
usleep(THREAD_SLEEP);
}
@ -3920,7 +3922,7 @@ static int MenuSettings()
GuiImage networkBtnIcon(&iconNetwork);
GuiButton networkBtn(btnLargeOutline.GetWidth(), btnLargeOutline.GetHeight());
networkBtn.SetAlignment(ALIGN_CENTRE, ALIGN_TOP);
networkBtn.SetPosition(0, 250);
networkBtn.SetPosition(-125, 250);
networkBtn.SetLabel(&networkBtnTxt);
networkBtn.SetImage(&networkBtnImg);
networkBtn.SetImageOver(&networkBtnImgOver);
@ -3931,6 +3933,23 @@ static int MenuSettings()
networkBtn.SetTrigger(trig2);
networkBtn.SetEffectGrow();
GuiText creditsBtnTxt("Credits", 22, (GXColor){0, 0, 0, 255});
creditsBtnTxt.SetWrap(true, btnLargeOutline.GetWidth()-20);
GuiImage creditsBtnImg(&btnLargeOutline);
GuiImage creditsBtnImgOver(&btnLargeOutlineOver);
GuiButton creditsBtn(btnLargeOutline.GetWidth(), btnLargeOutline.GetHeight());
creditsBtn.SetAlignment(ALIGN_CENTRE, ALIGN_TOP);
creditsBtn.SetPosition(125, 250);
creditsBtn.SetLabel(&creditsBtnTxt);
creditsBtn.SetImage(&creditsBtnImg);
creditsBtn.SetImageOver(&creditsBtnImgOver);
creditsBtn.SetSoundOver(&btnSoundOver);
creditsBtn.SetSoundClick(&btnSoundClick);
creditsBtn.SetTrigger(trigA);
creditsBtn.SetTrigger(trig2);
creditsBtn.SetEffectGrow();
creditsBtn.SetUpdateCallback(WindowCredits);
GuiText backBtnTxt("Go Back", 22, (GXColor){0, 0, 0, 255});
GuiImage backBtnImg(&btnOutline);
GuiImage backBtnImgOver(&btnOutlineOver);
@ -3967,6 +3986,7 @@ static int MenuSettings()
w.Append(&savingBtn);
w.Append(&menuBtn);
w.Append(&networkBtn);
w.Append(&creditsBtn);
w.Append(&backBtn);
w.Append(&resetBtn);
@ -3990,6 +4010,11 @@ static int MenuSettings()
{
menu = MENU_SETTINGS_NETWORK;
}
else if(creditsBtn.GetState() == STATE_CLICKED)
{
showCredits = true;
creditsBtn.SetState(STATE_SELECTED);
}
else if(backBtn.GetState() == STATE_CLICKED)
{
menu = MENU_GAMESELECTION;
@ -4720,6 +4745,11 @@ MainMenu (int menu)
break;
}
lastMenu = currentMenu;
if (btnLogo->GetState() == STATE_CLICKED)
{
showCredits = true;
btnLogo->ResetState();
}
usleep(THREAD_SLEEP);
}