Toggle switches work

This commit is contained in:
Dylan Smith
2026-01-16 15:45:32 -05:00
parent ed31755a3a
commit fd46ea65ca
3 changed files with 38 additions and 14 deletions

View File

@@ -7,7 +7,7 @@ static const uint16_t entry_height = 40;
static const uint16_t padding_x = 10;
static const uint16_t padding_y = 0;
static const pixel_t enabled_text_color = MAKE_PIXEL(255, 255, 255);
static const pixel_t disabled_text_color = MAKE_PIXEL(128, 128, 128);
static const pixel_t disabled_text_color = MAKE_PIXEL(80, 80, 80);
static const pixel_t entry_bg_color = MAKE_PIXEL(0, 0, 0);
static const pixel_t highlighted_bg_color = MAKE_PIXEL(50, 50, 50);
static const pixel_t highlighted_text_color = MAKE_PIXEL(255, 255, 0);
@@ -38,6 +38,18 @@ void draw_menu_entry(volatile pixel_t *const framebuffer, const graphical_menu_t
draw_string(framebuffer, &runescape_font,
padding_x, text_baseline_y,
entry->title, text_color);
if (entry->extra_draw_function != NULL)
{
const menu_entry_size_t menu_entry_size = {
.x = 0,
.y = y_pos,
.width = DISPLAY_WIDTH,
.height = entry_height,
};
entry->extra_draw_function(&menu_entry_size, entry->extra_draw_function_args);
}
}
void draw_menu(volatile pixel_t *const framebuffer, const graphical_menu_t *const menu)
@@ -54,7 +66,6 @@ void partial_redraw_menu(volatile pixel_t *const framebuffer, graphical_menu_t *
{
draw_menu_entry(framebuffer, menu, old_highlighted_entry_idx);
draw_menu_entry(framebuffer, menu, new_highlighted_entry_idx);
}
void select_menu_entry(graphical_menu_t *const menu)