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++)
gridBtn[i]->Update(t);
if (ticks_to_millisecs(diff_ticks(time, gettime())) < 100)
return;
btnLeft->Update(t);
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)
{
btnLeft->Update(t);
if((btnLeft->GetState() == STATE_CLICKED) && !AnimationRunning) {
btnLeft->SetState(STATE_DEFAULT);
time = gettime();
fAnimation -= chanWidth * 4.f;
pageNo--;
UpdateTooltips();
}
}
else if ((btnRight->GetState() == STATE_CLICKED) && !AnimationRunning)
{
if (!((buttons & WPAD_BUTTON_A) || (buttons & WPAD_BUTTON_PLUS) ||
(buttons & WPAD_CLASSIC_BUTTON_A) || (buttons & WPAD_CLASSIC_BUTTON_PLUS) ||
(buttonsPAD & PAD_BUTTON_A) || (buttonsPAD & PAD_TRIGGER_R) || t->Right()))
{
btnRight->ResetState();
return;
}
if (pageNo < pageCnt - 1)
{
btnRight->Update(t);
if((btnRight->GetState() == STATE_CLICKED) && !AnimationRunning) {
btnRight->SetState(STATE_DEFAULT);
time = gettime();
fAnimation += chanWidth * 4.f;
pageNo++;
UpdateTooltips();

View File

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