swapping screenshots mode with + button

This commit is contained in:
Zalo 2019-01-05 10:54:30 +01:00
parent 052b068223
commit 9080a54671

View File

@ -954,8 +954,15 @@ static int MenuGameSelection()
gameBrowser.SetPosition(20, 98);
ResetBrowser();
GuiTrigger trigPlusMinus;
trigPlusMinus.SetButtonOnlyTrigger(-1, WPAD_BUTTON_PLUS | WPAD_CLASSIC_BUTTON_PLUS, PAD_TRIGGER_Z, WIIDRC_BUTTON_PLUS);
GuiImage bgPreview(&bgPreviewImg);
bgPreview.SetPosition(365, 98);
GuiButton bgPreviewBtn(bgPreview.GetWidth(), bgPreview.GetHeight());
bgPreviewBtn.SetImage(&bgPreview);
bgPreviewBtn.SetPosition(365, 98);
bgPreviewBtn.SetTrigger(&trigPlusMinus);
int previousPreviewImg = GCSettings.PreviewImage;
GuiImage preview;
preview.SetAlignment(ALIGN_CENTRE, ALIGN_MIDDLE);
@ -970,7 +977,7 @@ static int MenuGameSelection()
mainWindow->Append(&titleTxt);
mainWindow->Append(&gameBrowser);
mainWindow->Append(&buttonWindow);
mainWindow->Append(&bgPreview);
mainWindow->Append(&bgPreviewBtn);
mainWindow->Append(&preview);
ResumeGui();
@ -1045,9 +1052,10 @@ static int MenuGameSelection()
}
//update game screenshot
if(previousBrowserIndex != browser.selIndex)
if(previousBrowserIndex != browser.selIndex || previousPreviewImg != GCSettings.PreviewImage)
{
previousBrowserIndex = browser.selIndex;
previousPreviewImg = GCSettings.PreviewImage;
snprintf(screenshotPath, MAXJOLIET, "%s%s/%s.png", pathPrefix[GCSettings.LoadMethod], ImageFolder(), browserList[browser.selIndex].displayname);
AllocSaveBuffer();
@ -1075,6 +1083,11 @@ static int MenuGameSelection()
menu = MENU_SETTINGS;
else if(exitBtn.GetState() == STATE_CLICKED)
ExitRequested = 1;
else if(bgPreviewBtn.GetState() == STATE_CLICKED)
{
GCSettings.PreviewImage = (GCSettings.PreviewImage + 1) % 3;
bgPreviewBtn.ResetState();
}
}
HaltParseThread(); // halt parsing
@ -1083,7 +1096,7 @@ static int MenuGameSelection()
mainWindow->Remove(&titleTxt);
mainWindow->Remove(&buttonWindow);
mainWindow->Remove(&gameBrowser);
mainWindow->Remove(&bgPreview);
mainWindow->Remove(&bgPreviewBtn);
mainWindow->Remove(&preview);
MEM_DEALLOC(imgBuffer);
return menu;