mirror of
https://github.com/dborth/vbagx.git
synced 2024-11-29 14:04:16 +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();
|
label[0]->Draw();
|
||||||
|
|
||||||
if(labelOver[1])
|
if(labelOver[1])
|
||||||
|
|
||||||
labelOver[1]->Draw();
|
labelOver[1]->Draw();
|
||||||
else if(label[1])
|
else if(label[1])
|
||||||
label[1]->Draw();
|
label[1]->Draw();
|
||||||
|
@ -9,7 +9,7 @@
|
|||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
|
|
||||||
#include "gui.h"
|
#include "gui.h"
|
||||||
#include "filebrowser.h"
|
#include "../filebrowser.h"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor for the GuiFileBrowser class.
|
* Constructor for the GuiFileBrowser class.
|
||||||
@ -52,7 +52,7 @@ GuiFileBrowser::GuiFileBrowser(int w, int h)
|
|||||||
scrollbarImg = new GuiImage(scrollbar);
|
scrollbarImg = new GuiImage(scrollbar);
|
||||||
scrollbarImg->SetParent(this);
|
scrollbarImg->SetParent(this);
|
||||||
scrollbarImg->SetAlignment(ALIGN_RIGHT, ALIGN_TOP);
|
scrollbarImg->SetAlignment(ALIGN_RIGHT, ALIGN_TOP);
|
||||||
scrollbarImg->SetPosition(5, 30);
|
scrollbarImg->SetPosition(0, 30);
|
||||||
|
|
||||||
arrowDown = new GuiImageData(scrollbar_arrowdown_png);
|
arrowDown = new GuiImageData(scrollbar_arrowdown_png);
|
||||||
arrowDownImg = new GuiImage(arrowDown);
|
arrowDownImg = new GuiImage(arrowDown);
|
||||||
@ -78,7 +78,6 @@ GuiFileBrowser::GuiFileBrowser(int w, int h)
|
|||||||
arrowUpBtn->SetTrigger(trigHeldA);
|
arrowUpBtn->SetTrigger(trigHeldA);
|
||||||
arrowUpBtn->SetSoundOver(btnSoundOver);
|
arrowUpBtn->SetSoundOver(btnSoundOver);
|
||||||
arrowUpBtn->SetSoundClick(btnSoundClick);
|
arrowUpBtn->SetSoundClick(btnSoundClick);
|
||||||
arrowUpBtn->SetPosition(5, 0);
|
|
||||||
|
|
||||||
arrowDownBtn = new GuiButton(arrowDownImg->GetWidth(), arrowDownImg->GetHeight());
|
arrowDownBtn = new GuiButton(arrowDownImg->GetWidth(), arrowDownImg->GetHeight());
|
||||||
arrowDownBtn->SetParent(this);
|
arrowDownBtn->SetParent(this);
|
||||||
@ -91,7 +90,6 @@ GuiFileBrowser::GuiFileBrowser(int w, int h)
|
|||||||
arrowDownBtn->SetTrigger(trigHeldA);
|
arrowDownBtn->SetTrigger(trigHeldA);
|
||||||
arrowDownBtn->SetSoundOver(btnSoundOver);
|
arrowDownBtn->SetSoundOver(btnSoundOver);
|
||||||
arrowDownBtn->SetSoundClick(btnSoundClick);
|
arrowDownBtn->SetSoundClick(btnSoundClick);
|
||||||
arrowDownBtn->SetPosition(5, 0);
|
|
||||||
|
|
||||||
scrollbarBoxBtn = new GuiButton(scrollbarBoxImg->GetWidth(), scrollbarBoxImg->GetHeight());
|
scrollbarBoxBtn = new GuiButton(scrollbarBoxImg->GetWidth(), scrollbarBoxImg->GetHeight());
|
||||||
scrollbarBoxBtn->SetParent(this);
|
scrollbarBoxBtn->SetParent(this);
|
||||||
@ -104,7 +102,6 @@ GuiFileBrowser::GuiFileBrowser(int w, int h)
|
|||||||
scrollbarBoxBtn->SetClickable(false);
|
scrollbarBoxBtn->SetClickable(false);
|
||||||
scrollbarBoxBtn->SetHoldable(true);
|
scrollbarBoxBtn->SetHoldable(true);
|
||||||
scrollbarBoxBtn->SetTrigger(trigHeldA);
|
scrollbarBoxBtn->SetTrigger(trigHeldA);
|
||||||
scrollbarBoxBtn->SetPosition(5, 30);
|
|
||||||
|
|
||||||
for(int i=0; i<FILE_PAGESIZE; ++i)
|
for(int i=0; i<FILE_PAGESIZE; ++i)
|
||||||
{
|
{
|
||||||
@ -433,7 +430,7 @@ void GuiFileBrowser::Update(GuiTrigger * t)
|
|||||||
if(positionWiimote > 0)
|
if(positionWiimote > 0)
|
||||||
{
|
{
|
||||||
position = positionWiimote; // follow wiimote cursor
|
position = positionWiimote; // follow wiimote cursor
|
||||||
scrollbarBoxBtn->SetPosition(5,position+36);
|
scrollbarBoxBtn->SetPosition(0,position+36);
|
||||||
}
|
}
|
||||||
else if(listChanged || numEntries != browser.numEntries)
|
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;
|
position = 156 * (browser.pageIndex + FILE_PAGESIZE/2) / (float)browser.numEntries;
|
||||||
}
|
}
|
||||||
scrollbarBoxBtn->SetPosition(5,position+36);
|
scrollbarBoxBtn->SetPosition(0,position+36);
|
||||||
}
|
}
|
||||||
|
|
||||||
listChanged = false;
|
listChanged = false;
|
||||||
|
@ -9,7 +9,7 @@
|
|||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
|
|
||||||
#include "gui.h"
|
#include "gui.h"
|
||||||
#include "filebrowser.h"
|
#include "../filebrowser.h"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor for the GuiSaveBrowser class.
|
* Constructor for the GuiSaveBrowser class.
|
||||||
|
@ -927,7 +927,7 @@ static int MenuGameSelection()
|
|||||||
buttonWindow.Append(&exitBtn);
|
buttonWindow.Append(&exitBtn);
|
||||||
|
|
||||||
GuiFileBrowser gameBrowser(330, 268);
|
GuiFileBrowser gameBrowser(330, 268);
|
||||||
gameBrowser.SetPosition(30, 98);
|
gameBrowser.SetPosition(20, 98);
|
||||||
ResetBrowser();
|
ResetBrowser();
|
||||||
|
|
||||||
GuiImage bgPreview(&bgPreviewImg);
|
GuiImage bgPreview(&bgPreviewImg);
|
||||||
@ -974,34 +974,6 @@ static int MenuGameSelection()
|
|||||||
gameBrowser.TriggerUpdate();
|
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
|
// update gameWindow based on arrow buttons
|
||||||
// set MENU_EXIT if A button pressed on a game
|
// set MENU_EXIT if A button pressed on a game
|
||||||
for(i=0; i < FILE_PAGESIZE; i++)
|
for(i=0; i < FILE_PAGESIZE; i++)
|
||||||
@ -1028,7 +1000,6 @@ static int MenuGameSelection()
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
titleTxt.SetText(inSz ? szname : "Choose Game");
|
titleTxt.SetText(inSz ? szname : "Choose Game");
|
||||||
|
|
||||||
ResumeGui();
|
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)
|
if(settingsBtn.GetState() == STATE_CLICKED)
|
||||||
menu = MENU_SETTINGS;
|
menu = MENU_SETTINGS;
|
||||||
@ -1062,14 +1058,12 @@ static int MenuGameSelection()
|
|||||||
mainWindow->Remove(&titleTxt);
|
mainWindow->Remove(&titleTxt);
|
||||||
mainWindow->Remove(&buttonWindow);
|
mainWindow->Remove(&buttonWindow);
|
||||||
mainWindow->Remove(&gameBrowser);
|
mainWindow->Remove(&gameBrowser);
|
||||||
mainWindow->Remove(&preview);
|
|
||||||
mainWindow->Remove(&bgPreview);
|
mainWindow->Remove(&bgPreview);
|
||||||
|
mainWindow->Remove(&preview);
|
||||||
MEM_DEALLOC(imgBuffer);
|
MEM_DEALLOC(imgBuffer);
|
||||||
return menu;
|
return menu;
|
||||||
}
|
}
|
||||||
|
|
||||||
extern char DebugStr[50];
|
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* MenuGame
|
* MenuGame
|
||||||
*
|
*
|
||||||
@ -1084,7 +1078,6 @@ static int MenuGame()
|
|||||||
char s[64];
|
char s[64];
|
||||||
|
|
||||||
GuiText titleTxt(ROMFilename, 22, (GXColor){255, 255, 255, 255});
|
GuiText titleTxt(ROMFilename, 22, (GXColor){255, 255, 255, 255});
|
||||||
if (DebugStr[0]) titleTxt.SetText(DebugStr);
|
|
||||||
titleTxt.SetAlignment(ALIGN_LEFT, ALIGN_TOP);
|
titleTxt.SetAlignment(ALIGN_LEFT, ALIGN_TOP);
|
||||||
titleTxt.SetPosition(50,50);
|
titleTxt.SetPosition(50,50);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user