Refactored to use selection grid during round (#348)

* Added wrapping to selection grid

* Added return value to on_selection_changed to allow aborting on wrap

* Extracted button code to button.c/.h

* Bounds checking changes for selection_grid_move_selection_horz()

---------

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Rickey <ric@rf3.xyz>
This commit is contained in:
MeirGavish
2026-01-15 20:32:09 +02:00
committed by GitHub
co-authored by Copilot Rickey
parent b7cc3ec5d6
commit 5300846f73
5 changed files with 553 additions and 322 deletions
+29
View File
@@ -0,0 +1,29 @@
#include "button.h"
#include "audio_utils.h"
#include "soundbank.h"
#include <tonc.h>
void button_set_highlight(Button* button, bool highlight)
{
if (button == NULL)
return;
u16 set_color = highlight ? BTN_HIGHLIGHT_COLOR : pal_bg_mem[button->button_pal_idx];
memset16(&pal_bg_mem[button->border_pal_idx], set_color, 1);
}
void button_press(Button* button)
{
if (button == NULL || button->on_pressed == NULL ||
(button->can_be_pressed != NULL && !button->can_be_pressed()))
{
return;
}
play_sfx(SFX_BUTTON, MM_BASE_PITCH_RATE, BUTTON_SFX_VOLUME);
button->on_pressed();
}