fix savebrowser bugs

This commit is contained in:
dborth 2009-06-13 01:38:21 +00:00
parent 5c955c824e
commit ab2bd752f0
2 changed files with 10 additions and 5 deletions

View File

@ -843,6 +843,7 @@ class GuiSaveBrowser : public GuiElement
int selectedItem; int selectedItem;
int listOffset; int listOffset;
int action; int action;
bool saveBtnLastOver[SAVELISTSIZE];
SaveList * saves; SaveList * saves;
GuiButton * saveBtn[SAVELISTSIZE]; GuiButton * saveBtn[SAVELISTSIZE];

View File

@ -114,7 +114,10 @@ GuiSaveBrowser::GuiSaveBrowser(int w, int h, SaveList * s, int a)
saveBtn[i]->SetVisible(false); saveBtn[i]->SetVisible(false);
saveBtn[i]->SetSoundOver(btnSoundOver); saveBtn[i]->SetSoundOver(btnSoundOver);
saveBtn[i]->SetSoundClick(btnSoundClick); saveBtn[i]->SetSoundClick(btnSoundClick);
saveBtnLastOver[i] = false;
} }
saveBtn[0]->SetState(STATE_SELECTED, -1);
saveBtn[0]->SetVisible(true);
} }
/** /**
@ -229,6 +232,8 @@ void GuiSaveBrowser::Update(GuiTrigger * t)
if(!focus) if(!focus)
goto endNavigation; // skip navigation goto endNavigation; // skip navigation
if(selectedItem < 0) selectedItem = 0;
if(t->Right()) if(t->Right())
{ {
if(selectedItem == SAVELISTSIZE-1) if(selectedItem == SAVELISTSIZE-1)
@ -384,12 +389,11 @@ void GuiSaveBrowser::Update(GuiTrigger * t)
else if(focus && i == selectedItem && saveBtn[i]->GetState() == STATE_DEFAULT) else if(focus && i == selectedItem && saveBtn[i]->GetState() == STATE_DEFAULT)
saveBtn[selectedItem]->SetState(STATE_SELECTED, t->chan); saveBtn[selectedItem]->SetState(STATE_SELECTED, t->chan);
if(t->wpad.ir.valid && !saveBtn[i]->IsInside(t->wpad.ir.x, t->wpad.ir.y) if(t->wpad.ir.valid)
&& saveBtn[i]->GetState() == STATE_SELECTED)
{ {
if(!saveBtnLastOver[i] && saveBtn[i]->IsInside(t->wpad.ir.x, t->wpad.ir.y))
saveBtn[i]->ResetState(); saveBtn[i]->ResetState();
if(selectedItem == i) saveBtnLastOver[i] = saveBtn[i]->IsInside(t->wpad.ir.x, t->wpad.ir.y);
selectedItem = -1;
} }
saveBtn[i]->Update(t); saveBtn[i]->Update(t);