allow players to change paginated pages with L/R (#354)

This commit is contained in:
Isaac0-dev 2023-04-24 02:10:30 +10:00 committed by GitHub
parent 0ec8a42c25
commit e44a3c775d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 18 additions and 0 deletions

View File

@ -8,6 +8,9 @@
// events //
////////////
static bool lTrigDown = false;
static bool rTrigDown = false;
static struct DjuiButton* sPrevButton = NULL;
static struct DjuiButton* sNextButton = NULL;
static struct DjuiText* sPageNumText = NULL;
@ -106,6 +109,21 @@ bool djui_paginated_render(struct DjuiBase* base) {
}
djui_rect_render(base);
OSContPad* pad = &gInteractablePad;
if (pad->button & L_TRIG) {
lTrigDown = true;
} else if (pad->button & R_TRIG) {
rTrigDown = true;
} else if (lTrigDown) {
djui_paginated_prev(&paginated->prevButton->base);
lTrigDown = false;
} else if (rTrigDown) {
djui_paginated_next(&paginated->nextButton->base);
rTrigDown = false;
}
return true;
}