From e44a3c775da8693198b5f39f8b29a4a84988d3db Mon Sep 17 00:00:00 2001 From: Isaac0-dev <62234577+Isaac0-dev@users.noreply.github.com> Date: Mon, 24 Apr 2023 02:10:30 +1000 Subject: [PATCH] allow players to change paginated pages with L/R (#354) --- src/pc/djui/djui_paginated.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/src/pc/djui/djui_paginated.c b/src/pc/djui/djui_paginated.c index 6401d813..ab4314cf 100644 --- a/src/pc/djui/djui_paginated.c +++ b/src/pc/djui/djui_paginated.c @@ -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; }