fix savebrowser bugs

This commit is contained in:
dborth 2009-06-13 01:39:26 +00:00
parent 279333fd01
commit d9c9fc15a7
2 changed files with 10 additions and 5 deletions

View File

@ -843,6 +843,7 @@ class GuiSaveBrowser : public GuiElement
int selectedItem;
int listOffset;
int action;
bool saveBtnLastOver[SAVELISTSIZE];
SaveList * saves;
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]->SetSoundOver(btnSoundOver);
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)
goto endNavigation; // skip navigation
if(selectedItem < 0) selectedItem = 0;
if(t->Right())
{
if(selectedItem == SAVELISTSIZE-1)
@ -384,12 +389,11 @@ void GuiSaveBrowser::Update(GuiTrigger * t)
else if(focus && i == selectedItem && saveBtn[i]->GetState() == STATE_DEFAULT)
saveBtn[selectedItem]->SetState(STATE_SELECTED, t->chan);
if(t->wpad.ir.valid && !saveBtn[i]->IsInside(t->wpad.ir.x, t->wpad.ir.y)
&& saveBtn[i]->GetState() == STATE_SELECTED)
if(t->wpad.ir.valid)
{
saveBtn[i]->ResetState();
if(selectedItem == i)
selectedItem = -1;
if(!saveBtnLastOver[i] && saveBtn[i]->IsInside(t->wpad.ir.x, t->wpad.ir.y))
saveBtn[i]->ResetState();
saveBtnLastOver[i] = saveBtn[i]->IsInside(t->wpad.ir.x, t->wpad.ir.y);
}
saveBtn[i]->Update(t);