mirror of
https://github.com/dborth/vbagx.git
synced 2024-11-22 10:39:18 +01:00
make GUI element positioning consistent with snes9x gx
This commit is contained in:
parent
e4f0938c2f
commit
43e84a299e
@ -156,6 +156,7 @@ void GuiButton::Draw()
|
||||
label[0]->Draw();
|
||||
|
||||
if(labelOver[1])
|
||||
|
||||
labelOver[1]->Draw();
|
||||
else if(label[1])
|
||||
label[1]->Draw();
|
||||
@ -272,7 +273,7 @@ void GuiButton::Update(GuiTrigger * t)
|
||||
(wm_btns == wm_btns_trig ||
|
||||
(cc_btns == cc_btns_trig && t->wpad->exp.type == EXP_CLASSIC))) ||
|
||||
(t->pad.btns_d == trigger[i]->pad.btns_d && t->pad.btns_d > 0))
|
||||
|
||||
|
||||
{
|
||||
if(t->chan == stateChan || stateChan == -1)
|
||||
{
|
||||
@ -319,7 +320,7 @@ void GuiButton::Update(GuiTrigger * t)
|
||||
cc_btns = t->wpad->btns_d >> 16;
|
||||
cc_btns_h = t->wpad->btns_h >> 16;
|
||||
cc_btns_trig = trigger[i]->wpad->btns_h >> 16;
|
||||
|
||||
|
||||
if(
|
||||
(t->wpad->btns_d > 0 &&
|
||||
(wm_btns == wm_btns_trig ||
|
||||
@ -336,7 +337,7 @@ void GuiButton::Update(GuiTrigger * t)
|
||||
(wm_btns_h == wm_btns_trig ||
|
||||
(cc_btns_h == cc_btns_trig && t->wpad->exp.type == EXP_CLASSIC))) ||
|
||||
(t->pad.btns_h == trigger[i]->pad.btns_h && t->pad.btns_h > 0))
|
||||
|
||||
|
||||
{
|
||||
if(trigger[i]->type == TRIGGER_HELD)
|
||||
held = true;
|
||||
|
@ -9,7 +9,7 @@
|
||||
***************************************************************************/
|
||||
|
||||
#include "gui.h"
|
||||
#include "filebrowser.h"
|
||||
#include "../filebrowser.h"
|
||||
|
||||
/**
|
||||
* Constructor for the GuiFileBrowser class.
|
||||
@ -52,7 +52,7 @@ GuiFileBrowser::GuiFileBrowser(int w, int h)
|
||||
scrollbarImg = new GuiImage(scrollbar);
|
||||
scrollbarImg->SetParent(this);
|
||||
scrollbarImg->SetAlignment(ALIGN_RIGHT, ALIGN_TOP);
|
||||
scrollbarImg->SetPosition(5, 30);
|
||||
scrollbarImg->SetPosition(0, 30);
|
||||
|
||||
arrowDown = new GuiImageData(scrollbar_arrowdown_png);
|
||||
arrowDownImg = new GuiImage(arrowDown);
|
||||
@ -78,7 +78,6 @@ GuiFileBrowser::GuiFileBrowser(int w, int h)
|
||||
arrowUpBtn->SetTrigger(trigHeldA);
|
||||
arrowUpBtn->SetSoundOver(btnSoundOver);
|
||||
arrowUpBtn->SetSoundClick(btnSoundClick);
|
||||
arrowUpBtn->SetPosition(5, 0);
|
||||
|
||||
arrowDownBtn = new GuiButton(arrowDownImg->GetWidth(), arrowDownImg->GetHeight());
|
||||
arrowDownBtn->SetParent(this);
|
||||
@ -91,7 +90,6 @@ GuiFileBrowser::GuiFileBrowser(int w, int h)
|
||||
arrowDownBtn->SetTrigger(trigHeldA);
|
||||
arrowDownBtn->SetSoundOver(btnSoundOver);
|
||||
arrowDownBtn->SetSoundClick(btnSoundClick);
|
||||
arrowDownBtn->SetPosition(5, 0);
|
||||
|
||||
scrollbarBoxBtn = new GuiButton(scrollbarBoxImg->GetWidth(), scrollbarBoxImg->GetHeight());
|
||||
scrollbarBoxBtn->SetParent(this);
|
||||
@ -104,7 +102,6 @@ GuiFileBrowser::GuiFileBrowser(int w, int h)
|
||||
scrollbarBoxBtn->SetClickable(false);
|
||||
scrollbarBoxBtn->SetHoldable(true);
|
||||
scrollbarBoxBtn->SetTrigger(trigHeldA);
|
||||
scrollbarBoxBtn->SetPosition(5, 30);
|
||||
|
||||
for(int i=0; i<FILE_PAGESIZE; ++i)
|
||||
{
|
||||
@ -433,7 +430,7 @@ void GuiFileBrowser::Update(GuiTrigger * t)
|
||||
if(positionWiimote > 0)
|
||||
{
|
||||
position = positionWiimote; // follow wiimote cursor
|
||||
scrollbarBoxBtn->SetPosition(5,position+36);
|
||||
scrollbarBoxBtn->SetPosition(0,position+36);
|
||||
}
|
||||
else if(listChanged || numEntries != browser.numEntries)
|
||||
{
|
||||
@ -449,7 +446,7 @@ void GuiFileBrowser::Update(GuiTrigger * t)
|
||||
{
|
||||
position = 156 * (browser.pageIndex + FILE_PAGESIZE/2) / (float)browser.numEntries;
|
||||
}
|
||||
scrollbarBoxBtn->SetPosition(5,position+36);
|
||||
scrollbarBoxBtn->SetPosition(0,position+36);
|
||||
}
|
||||
|
||||
listChanged = false;
|
||||
|
@ -9,7 +9,7 @@
|
||||
***************************************************************************/
|
||||
|
||||
#include "gui.h"
|
||||
#include "filebrowser.h"
|
||||
#include "../filebrowser.h"
|
||||
|
||||
/**
|
||||
* Constructor for the GuiSaveBrowser class.
|
||||
|
@ -927,9 +927,9 @@ static int MenuGameSelection()
|
||||
buttonWindow.Append(&exitBtn);
|
||||
|
||||
GuiFileBrowser gameBrowser(330, 268);
|
||||
gameBrowser.SetPosition(30, 98);
|
||||
gameBrowser.SetPosition(20, 98);
|
||||
ResetBrowser();
|
||||
|
||||
|
||||
GuiImage bgPreview(&bgPreviewImg);
|
||||
bgPreview.SetPosition(365, 98);
|
||||
|
||||
@ -973,34 +973,6 @@ static int MenuGameSelection()
|
||||
mainWindow->ChangeFocus(&gameBrowser);
|
||||
gameBrowser.TriggerUpdate();
|
||||
}
|
||||
|
||||
//update gamelist image
|
||||
if(previousBrowserIndex != browser.selIndex)
|
||||
{
|
||||
previousBrowserIndex = browser.selIndex;
|
||||
snprintf(imagePath, MAXJOLIET, "%s%s/%s.png", pathPrefix[GCSettings.LoadMethod], GCSettings.ImageFolder, browserList[browser.selIndex].displayname);
|
||||
|
||||
AllocSaveBuffer();
|
||||
int width, height;
|
||||
if(LoadFile(imagePath, SILENT))
|
||||
{
|
||||
if(DecodePNG(savebuffer, &width, &height, imgBuffer, 512, 512))
|
||||
{
|
||||
preview.SetImage(imgBuffer, width, height);
|
||||
preview.SetScale( MIN(225.0f / width, 235.0f / height) );
|
||||
}
|
||||
else
|
||||
{
|
||||
preview.SetImage(NULL, 0, 0);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
preview.SetImage(NULL, 0, 0);
|
||||
|
||||
}
|
||||
FreeSaveBuffer();
|
||||
}
|
||||
|
||||
// update gameWindow based on arrow buttons
|
||||
// set MENU_EXIT if A button pressed on a game
|
||||
@ -1027,8 +999,7 @@ static int MenuGameSelection()
|
||||
menu = MENU_GAMESELECTION;
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
|
||||
titleTxt.SetText(inSz ? szname : "Choose Game");
|
||||
|
||||
ResumeGui();
|
||||
@ -1048,7 +1019,32 @@ static int MenuGameSelection()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//update gamelist image
|
||||
if(previousBrowserIndex != browser.selIndex)
|
||||
{
|
||||
previousBrowserIndex = browser.selIndex;
|
||||
snprintf(imagePath, MAXJOLIET, "%s%s/%s.png", pathPrefix[GCSettings.LoadMethod], GCSettings.ImageFolder, browserList[browser.selIndex].displayname);
|
||||
|
||||
AllocSaveBuffer();
|
||||
int width, height;
|
||||
if(LoadFile(imagePath, SILENT))
|
||||
{
|
||||
if(DecodePNG(savebuffer, &width, &height, imgBuffer, 512, 512))
|
||||
{
|
||||
preview.SetImage(imgBuffer, width, height);
|
||||
preview.SetScale( MIN(225.0f / width, 235.0f / height) );
|
||||
}
|
||||
else
|
||||
{
|
||||
preview.SetImage(NULL, 0, 0);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
preview.SetImage(NULL, 0, 0);
|
||||
}
|
||||
FreeSaveBuffer();
|
||||
}
|
||||
|
||||
if(settingsBtn.GetState() == STATE_CLICKED)
|
||||
menu = MENU_SETTINGS;
|
||||
@ -1062,14 +1058,12 @@ static int MenuGameSelection()
|
||||
mainWindow->Remove(&titleTxt);
|
||||
mainWindow->Remove(&buttonWindow);
|
||||
mainWindow->Remove(&gameBrowser);
|
||||
mainWindow->Remove(&preview);
|
||||
mainWindow->Remove(&bgPreview);
|
||||
mainWindow->Remove(&preview);
|
||||
MEM_DEALLOC(imgBuffer);
|
||||
return menu;
|
||||
}
|
||||
|
||||
extern char DebugStr[50];
|
||||
|
||||
/****************************************************************************
|
||||
* MenuGame
|
||||
*
|
||||
@ -1084,7 +1078,6 @@ static int MenuGame()
|
||||
char s[64];
|
||||
|
||||
GuiText titleTxt(ROMFilename, 22, (GXColor){255, 255, 255, 255});
|
||||
if (DebugStr[0]) titleTxt.SetText(DebugStr);
|
||||
titleTxt.SetAlignment(ALIGN_LEFT, ALIGN_TOP);
|
||||
titleTxt.SetPosition(50,50);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user