swapping preiews with + button

This commit is contained in:
Zalo 2019-01-05 13:18:57 +01:00
parent 2f40cee1d4
commit 36aedc24c4

View File

@ -928,8 +928,15 @@ static int MenuGameSelection()
gameBrowser.SetPosition(20, 98); gameBrowser.SetPosition(20, 98);
ResetBrowser(); ResetBrowser();
GuiTrigger trigPlusMinus;
trigPlusMinus.SetButtonOnlyTrigger(-1, WPAD_BUTTON_PLUS | WPAD_CLASSIC_BUTTON_PLUS, PAD_TRIGGER_Z, WIIDRC_BUTTON_PLUS);
GuiImage bgPreview(&bgPreviewImg); 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; GuiImage preview;
preview.SetAlignment(ALIGN_CENTRE, ALIGN_MIDDLE); preview.SetAlignment(ALIGN_CENTRE, ALIGN_MIDDLE);
@ -944,7 +951,7 @@ static int MenuGameSelection()
mainWindow->Append(&titleTxt); mainWindow->Append(&titleTxt);
mainWindow->Append(&gameBrowser); mainWindow->Append(&gameBrowser);
mainWindow->Append(&buttonWindow); mainWindow->Append(&buttonWindow);
mainWindow->Append(&bgPreview); mainWindow->Append(&bgPreviewBtn);
mainWindow->Append(&preview); mainWindow->Append(&preview);
ResumeGui(); ResumeGui();
@ -1018,9 +1025,10 @@ static int MenuGameSelection()
} }
//update gamelist image //update gamelist image
if(previousBrowserIndex != browser.selIndex) if(previousBrowserIndex != browser.selIndex || previousPreviewImg != GCSettings.PreviewImage)
{ {
previousBrowserIndex = browser.selIndex; previousBrowserIndex = browser.selIndex;
previousPreviewImg = GCSettings.PreviewImage;
snprintf(imagePath, MAXJOLIET, "%s%s/%s.png", pathPrefix[GCSettings.LoadMethod], ImageFolder(), browserList[browser.selIndex].displayname); snprintf(imagePath, MAXJOLIET, "%s%s/%s.png", pathPrefix[GCSettings.LoadMethod], ImageFolder(), browserList[browser.selIndex].displayname);
AllocSaveBuffer(); AllocSaveBuffer();
@ -1048,6 +1056,11 @@ static int MenuGameSelection()
menu = MENU_SETTINGS; menu = MENU_SETTINGS;
else if(exitBtn.GetState() == STATE_CLICKED) else if(exitBtn.GetState() == STATE_CLICKED)
ExitRequested = 1; ExitRequested = 1;
else if(bgPreviewBtn.GetState() == STATE_CLICKED)
{
GCSettings.PreviewImage = (GCSettings.PreviewImage + 1) % 3;
bgPreviewBtn.ResetState();
}
} }
HaltParseThread(); // halt parsing HaltParseThread(); // halt parsing
@ -1056,7 +1069,7 @@ static int MenuGameSelection()
mainWindow->Remove(&titleTxt); mainWindow->Remove(&titleTxt);
mainWindow->Remove(&buttonWindow); mainWindow->Remove(&buttonWindow);
mainWindow->Remove(&gameBrowser); mainWindow->Remove(&gameBrowser);
mainWindow->Remove(&bgPreview); mainWindow->Remove(&bgPreviewBtn);
mainWindow->Remove(&preview); mainWindow->Remove(&preview);
MEM_DEALLOC(imgBuffer); MEM_DEALLOC(imgBuffer);
return menu; return menu;