Make the channel grid scrollable

This commit is contained in:
wiidev 2023-01-01 17:00:11 +00:00
parent b97f2305f9
commit 921f67438b
2 changed files with 31 additions and 12 deletions

View File

@ -289,25 +289,43 @@ void GuiBannerGrid::Update(GuiTrigger *t)
for(int i = 0; i < MAX_BUTTONS && !AnimationRunning; i++) for(int i = 0; i < MAX_BUTTONS && !AnimationRunning; i++)
gridBtn[i]->Update(t); gridBtn[i]->Update(t);
if(pageNo > 0) if (ticks_to_millisecs(diff_ticks(time, gettime())) < 100)
{ return;
btnLeft->Update(t);
if((btnLeft->GetState() == STATE_CLICKED) && !AnimationRunning) { btnLeft->Update(t);
btnLeft->SetState(STATE_DEFAULT); btnRight->Update(t);
u32 buttons = t->wpad.btns_h;
u32 buttonsPAD = t->pad.btns_h;
if ((btnLeft->GetState() == STATE_CLICKED) && !AnimationRunning)
{
if (!((buttons & WPAD_BUTTON_A) || (buttons & WPAD_BUTTON_MINUS) ||
(buttons & WPAD_CLASSIC_BUTTON_A) || (buttons & WPAD_CLASSIC_BUTTON_MINUS) ||
(buttonsPAD & PAD_BUTTON_A) || (buttonsPAD & PAD_TRIGGER_L) || t->Left()))
{
btnLeft->ResetState();
return;
}
if (pageNo > 0)
{
time = gettime();
fAnimation -= chanWidth * 4.f; fAnimation -= chanWidth * 4.f;
pageNo--; pageNo--;
UpdateTooltips(); UpdateTooltips();
} }
} }
else if ((btnRight->GetState() == STATE_CLICKED) && !AnimationRunning)
if(pageNo < pageCnt-1)
{ {
btnRight->Update(t); if (!((buttons & WPAD_BUTTON_A) || (buttons & WPAD_BUTTON_PLUS) ||
(buttons & WPAD_CLASSIC_BUTTON_A) || (buttons & WPAD_CLASSIC_BUTTON_PLUS) ||
if((btnRight->GetState() == STATE_CLICKED) && !AnimationRunning) { (buttonsPAD & PAD_BUTTON_A) || (buttonsPAD & PAD_TRIGGER_R) || t->Right()))
btnRight->SetState(STATE_DEFAULT); {
btnRight->ResetState();
return;
}
if (pageNo < pageCnt - 1)
{
time = gettime();
fAnimation += chanWidth * 4.f; fAnimation += chanWidth * 4.f;
pageNo++; pageNo++;
UpdateTooltips(); UpdateTooltips();

View File

@ -59,6 +59,7 @@ private:
int pageNo; int pageNo;
int pageCnt; int pageCnt;
u64 time;
Vec2f ScreenProps; Vec2f ScreenProps;
Texture gridFrameTex; Texture gridFrameTex;