improve scrollbars, minor UI tweaks

This commit is contained in:
dborth 2009-04-27 07:00:14 +00:00
parent 5f62723de3
commit 19b0209048
8 changed files with 23 additions and 85 deletions

View File

@ -796,7 +796,6 @@ class GuiOptionBrowser : public GuiElement
GuiButton * arrowUpBtn;
GuiButton * arrowDownBtn;
GuiButton * scrollbarBoxBtn;
GuiImage * bgOptionsImg;
GuiImage * scrollbarImg;
@ -804,8 +803,6 @@ class GuiOptionBrowser : public GuiElement
GuiImage * arrowDownOverImg;
GuiImage * arrowUpImg;
GuiImage * arrowUpOverImg;
GuiImage * scrollbarBoxImg;
GuiImage * scrollbarBoxOverImg;
GuiImageData * bgOptions;
GuiImageData * bgOptionsEntry;
@ -814,8 +811,6 @@ class GuiOptionBrowser : public GuiElement
GuiImageData * arrowDownOver;
GuiImageData * arrowUp;
GuiImageData * arrowUpOver;
GuiImageData * scrollbarBox;
GuiImageData * scrollbarBoxOver;
GuiSound * btnSoundOver;
GuiSound * btnSoundClick;
@ -860,15 +855,12 @@ class GuiSaveBrowser : public GuiElement
GuiButton * arrowUpBtn;
GuiButton * arrowDownBtn;
GuiButton * scrollbarBoxBtn;
GuiImage * scrollbarImg;
GuiImage * arrowDownImg;
GuiImage * arrowDownOverImg;
GuiImage * arrowUpImg;
GuiImage * arrowUpOverImg;
GuiImage * scrollbarBoxImg;
GuiImage * scrollbarBoxOverImg;
GuiImageData * gameSave;
GuiImageData * gameSaveOver;
@ -878,8 +870,6 @@ class GuiSaveBrowser : public GuiElement
GuiImageData * arrowDownOver;
GuiImageData * arrowUp;
GuiImageData * arrowUpOver;
GuiImageData * scrollbarBox;
GuiImageData * scrollbarBoxOver;
GuiSound * btnSoundOver;
GuiSound * btnSoundClick;

View File

@ -92,7 +92,7 @@ GuiFileBrowser::GuiFileBrowser(int w, int h)
scrollbarBoxBtn->SetImageOver(scrollbarBoxOverImg);
scrollbarBoxBtn->SetAlignment(ALIGN_RIGHT, ALIGN_TOP);
scrollbarBoxBtn->SetMinY(0);
scrollbarBoxBtn->SetMaxY(304);
scrollbarBoxBtn->SetMaxY(136);
scrollbarBoxBtn->SetSelectable(false);
scrollbarBoxBtn->SetClickable(false);
scrollbarBoxBtn->SetHoldable(true);
@ -216,7 +216,8 @@ void GuiFileBrowser::Update(GuiTrigger * t)
if(state == STATE_DISABLED || !t)
return;
int position;
int position = 0;
int positionWiimote = 0;
arrowUpBtn->Update(t);
arrowDownBtn->Update(t);
@ -230,14 +231,14 @@ void GuiFileBrowser::Update(GuiTrigger * t)
)
{
scrollbarBoxBtn->SetPosition(0,0);
position = t->wpad.ir.y - 60 - scrollbarBoxBtn->GetTop();
positionWiimote = t->wpad.ir.y - 60 - scrollbarBoxBtn->GetTop();
if(position < scrollbarBoxBtn->GetMinY())
position = scrollbarBoxBtn->GetMinY();
else if(position > scrollbarBoxBtn->GetMaxY())
position = scrollbarBoxBtn->GetMaxY();
if(positionWiimote < scrollbarBoxBtn->GetMinY())
positionWiimote = scrollbarBoxBtn->GetMinY();
else if(positionWiimote > scrollbarBoxBtn->GetMaxY())
positionWiimote = scrollbarBoxBtn->GetMaxY();
browser.pageIndex = (position * browser.numEntries)/136.0 - selectedItem;
browser.pageIndex = (positionWiimote * browser.numEntries)/136.0 - selectedItem;
if(browser.pageIndex <= 0)
{
@ -250,6 +251,7 @@ void GuiFileBrowser::Update(GuiTrigger * t)
selectedItem = PAGESIZE-1;
}
listChanged = true;
focus = false;
}
if(arrowDownBtn->GetState() == STATE_HELD && arrowDownBtn->GetStateChan() == t->chan)
@ -375,11 +377,12 @@ void GuiFileBrowser::Update(GuiTrigger * t)
}
// update the location of the scroll box based on the position in the file list
if(listChanged)
{
if(positionWiimote > 0)
position = positionWiimote; // follow wiimote cursor
else
position = 136*(browser.pageIndex + selectedItem) / browser.numEntries;
scrollbarBoxBtn->SetPosition(0,position+36);
}
listChanged = false;

View File

@ -54,10 +54,6 @@ GuiOptionBrowser::GuiOptionBrowser(int w, int h, OptionList * l)
arrowUpImg = new GuiImage(arrowUp);
arrowUpOver = new GuiImageData(scrollbar_arrowup_over_png);
arrowUpOverImg = new GuiImage(arrowUpOver);
scrollbarBox = new GuiImageData(scrollbar_box_png);
scrollbarBoxImg = new GuiImage(scrollbarBox);
scrollbarBoxOver = new GuiImageData(scrollbar_box_over_png);
scrollbarBoxOverImg = new GuiImage(scrollbarBoxOver);
arrowUpBtn = new GuiButton(arrowUpImg->GetWidth(), arrowUpImg->GetHeight());
arrowUpBtn->SetParent(this);
@ -79,13 +75,6 @@ GuiOptionBrowser::GuiOptionBrowser(int w, int h, OptionList * l)
arrowDownBtn->SetSoundOver(btnSoundOver);
arrowDownBtn->SetSoundClick(btnSoundClick);
scrollbarBoxBtn = new GuiButton(scrollbarBoxImg->GetWidth(), scrollbarBoxImg->GetHeight());
scrollbarBoxBtn->SetParent(this);
scrollbarBoxBtn->SetImage(scrollbarBoxImg);
scrollbarBoxBtn->SetImageOver(scrollbarBoxOverImg);
scrollbarBoxBtn->SetAlignment(ALIGN_RIGHT, ALIGN_TOP);
scrollbarBoxBtn->SetSelectable(false);
for(int i=0; i<PAGESIZE; i++)
{
optionTxt[i] = new GuiText(options->name[i], 22, (GXColor){0, 0, 0, 0xff});
@ -116,7 +105,6 @@ GuiOptionBrowser::~GuiOptionBrowser()
{
delete arrowUpBtn;
delete arrowDownBtn;
delete scrollbarBoxBtn;
delete bgOptionsImg;
delete scrollbarImg;
@ -124,8 +112,6 @@ GuiOptionBrowser::~GuiOptionBrowser()
delete arrowDownOverImg;
delete arrowUpImg;
delete arrowUpOverImg;
delete scrollbarBoxImg;
delete scrollbarBoxOverImg;
delete bgOptions;
delete bgOptionsEntry;
@ -134,8 +120,6 @@ GuiOptionBrowser::~GuiOptionBrowser()
delete arrowDownOver;
delete arrowUp;
delete arrowUpOver;
delete scrollbarBox;
delete scrollbarBoxOver;
delete trigA;
delete btnSoundOver;
@ -241,7 +225,6 @@ void GuiOptionBrowser::Draw()
scrollbarImg->Draw();
arrowUpBtn->Draw();
arrowDownBtn->Draw();
scrollbarBoxBtn->Draw();
this->UpdateEffects();
}
@ -253,17 +236,8 @@ void GuiOptionBrowser::Update(GuiTrigger * t)
int next, prev;
// update the location of the scroll box based on the position in the option list
int position = 136*(listOffset+selectedItem)/options->length;
if(position > 130)
position = 136;
scrollbarBoxBtn->SetPosition(0,position+36);
arrowUpBtn->Update(t);
arrowDownBtn->Update(t);
scrollbarBoxBtn->Update(t);
next = listOffset;

View File

@ -58,10 +58,6 @@ GuiSaveBrowser::GuiSaveBrowser(int w, int h, SaveList * s, int a)
arrowUpImg = new GuiImage(arrowUp);
arrowUpOver = new GuiImageData(scrollbar_arrowup_over_png);
arrowUpOverImg = new GuiImage(arrowUpOver);
scrollbarBox = new GuiImageData(scrollbar_box_png);
scrollbarBoxImg = new GuiImage(scrollbarBox);
scrollbarBoxOver = new GuiImageData(scrollbar_box_over_png);
scrollbarBoxOverImg = new GuiImage(scrollbarBoxOver);
arrowUpBtn = new GuiButton(arrowUpImg->GetWidth(), arrowUpImg->GetHeight());
arrowUpBtn->SetParent(this);
@ -83,13 +79,6 @@ GuiSaveBrowser::GuiSaveBrowser(int w, int h, SaveList * s, int a)
arrowDownBtn->SetSoundOver(btnSoundOver);
arrowDownBtn->SetSoundClick(btnSoundClick);
scrollbarBoxBtn = new GuiButton(scrollbarBoxImg->GetWidth(), scrollbarBoxImg->GetHeight());
scrollbarBoxBtn->SetParent(this);
scrollbarBoxBtn->SetImage(scrollbarBoxImg);
scrollbarBoxBtn->SetImageOver(scrollbarBoxOverImg);
scrollbarBoxBtn->SetAlignment(ALIGN_RIGHT, ALIGN_TOP);
scrollbarBoxBtn->SetSelectable(false);
for(int i=0; i<SAVELISTSIZE; i++)
{
saveDate[i] = new GuiText(NULL, 22, (GXColor){0, 0, 0, 0xff});
@ -135,15 +124,12 @@ GuiSaveBrowser::~GuiSaveBrowser()
{
delete arrowUpBtn;
delete arrowDownBtn;
delete scrollbarBoxBtn;
delete scrollbarImg;
delete arrowDownImg;
delete arrowDownOverImg;
delete arrowUpImg;
delete arrowUpOverImg;
delete scrollbarBoxImg;
delete scrollbarBoxOverImg;
delete gameSave;
delete gameSaveOver;
@ -153,8 +139,6 @@ GuiSaveBrowser::~GuiSaveBrowser()
delete arrowDownOver;
delete arrowUp;
delete arrowUpOver;
delete scrollbarBox;
delete scrollbarBoxOver;
delete btnSoundOver;
delete btnSoundClick;
@ -226,7 +210,6 @@ void GuiSaveBrowser::Draw()
scrollbarImg->Draw();
arrowUpBtn->Draw();
arrowDownBtn->Draw();
scrollbarBoxBtn->Draw();
this->UpdateEffects();
}
@ -238,21 +221,9 @@ void GuiSaveBrowser::Update(GuiTrigger * t)
int i, len;
char savetext[50];
// update the location of the scroll box based on the position in the option list
int position;
if(action == 0)
position = 136*(listOffset+selectedItem)/saves->length;
else
position = 136*(listOffset+selectedItem+2)/saves->length;
if(position > 130)
position = 136;
scrollbarBoxBtn->SetPosition(0,position+36);
arrowUpBtn->Update(t);
arrowDownBtn->Update(t);
scrollbarBoxBtn->Update(t);
// pad/joystick navigation
if(!focus)

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.0 KiB

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.2 KiB

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 13 KiB

After

Width:  |  Height:  |  Size: 8.3 KiB

View File

@ -1,7 +1,7 @@
/****************************************************************************
* Visual Boy Advance GX
*
* Tantric September 2008
* Tantric 2008-2009
*
* menu.cpp
*
@ -1301,7 +1301,7 @@ static int MenuGame()
}
else if(resetBtn.GetState() == STATE_CLICKED)
{
if (WindowPrompt("Reset Game", "Unsaved progress will be lost. Are you sure?", "OK", "Cancel"))
if (WindowPrompt("Reset Game", "Reset this game? Any unsaved progress will be lost.", "OK", "Cancel"))
{
emulator.emuReset();
menu = MENU_EXIT;
@ -1313,7 +1313,7 @@ static int MenuGame()
}
else if(mainmenuBtn.GetState() == STATE_CLICKED)
{
if (WindowPrompt("Exit Game", "Unsaved progress will be lost. Are you sure?", "OK", "Cancel"))
if (WindowPrompt("Quit Game", "Quit this game? Any unsaved progress will be lost.", "OK", "Cancel"))
{
if(gameScreenImg)
{