|
14 | 14 | #define ICON_WIDTH 20
|
15 | 15 | #define ICON_PADDING 3
|
16 | 16 | #define TEXT_BOTTOM_MARGIN 8
|
| 17 | +#define BUTTON_HEIGHT 12 |
17 | 18 |
|
18 | 19 | typedef struct {
|
19 | 20 | uint8_t x;
|
@@ -108,6 +109,31 @@ void main_menu_set_help_callback(MainMenu* main_menu, MainMenuItemCallback callb
|
108 | 109 | main_menu->help_context = context;
|
109 | 110 | }
|
110 | 111 |
|
| 112 | +static void draw_help_button(Canvas* canvas) { |
| 113 | + const char* str = "Help"; |
| 114 | + const size_t vertical_offset = 3; |
| 115 | + const size_t horizontal_offset = 3; |
| 116 | + const size_t string_width = canvas_string_width(canvas, str); |
| 117 | + |
| 118 | + // Create a small arrow icon directly |
| 119 | + const uint8_t arrow_width = 7; |
| 120 | + const uint8_t arrow_height = 4; |
| 121 | + const int32_t icon_h_offset = 3; |
| 122 | + const int32_t icon_width_with_offset = arrow_width + icon_h_offset; |
| 123 | + const size_t button_width = string_width + horizontal_offset * 2 + icon_width_with_offset; |
| 124 | + |
| 125 | + const int32_t x = (canvas_width(canvas) - button_width) / 2; |
| 126 | + const int32_t y = canvas_height(canvas); |
| 127 | + |
| 128 | + // Draw text |
| 129 | + canvas_draw_str(canvas, x + horizontal_offset, y - vertical_offset, str); |
| 130 | + |
| 131 | + // Draw small down arrow |
| 132 | + const int32_t arrow_x = x + horizontal_offset + string_width + icon_h_offset; |
| 133 | + const int32_t arrow_y = y - vertical_offset - arrow_height; |
| 134 | + canvas_draw_line(canvas, arrow_x + 3, arrow_y + 3, arrow_x + 6, arrow_y); |
| 135 | + canvas_draw_line(canvas, arrow_x + 3, arrow_y + 3, arrow_x, arrow_y); |
| 136 | +} |
111 | 137 |
|
112 | 138 | static CardLayout calculate_card_layout(
|
113 | 139 | Canvas* canvas,
|
@@ -250,27 +276,10 @@ static void main_menu_view_draw_callback(Canvas* canvas, void* _model) {
|
250 | 276 | position++;
|
251 | 277 | }
|
252 | 278 |
|
253 |
| - // Draw help button last, so it's on top of everything |
| 279 | + // Draw help button last |
254 | 280 | canvas_set_font(canvas, FontSecondary);
|
255 | 281 | canvas_set_color(canvas, ColorBlack);
|
256 |
| - |
257 |
| - const size_t vertical_offset = 3; |
258 |
| - const size_t horizontal_offset = 3; |
259 |
| - const size_t string_width = canvas_string_width(canvas, "Help"); |
260 |
| - const Icon* icon = &I_ButtonDown_7x4; |
261 |
| - const int32_t icon_h_offset = 3; |
262 |
| - const int32_t icon_width_with_offset = icon_get_width(icon) + icon_h_offset; |
263 |
| - const int32_t icon_v_offset = icon_get_height(icon) + vertical_offset + 1; |
264 |
| - const size_t button_width = string_width + horizontal_offset * 2 + icon_width_with_offset; |
265 |
| - |
266 |
| - const int32_t x = (canvas_width(canvas) - button_width) / 2; |
267 |
| - const int32_t y = canvas_height(canvas); |
268 |
| - |
269 |
| - // Position at bottom with proper margins |
270 |
| - canvas_draw_str(canvas, x + horizontal_offset, y - vertical_offset, "Help"); |
271 |
| - canvas_draw_icon( |
272 |
| - canvas, x + horizontal_offset + string_width + icon_h_offset, y - icon_v_offset, icon); |
273 |
| - // Reset color |
| 282 | + draw_help_button(canvas); |
274 | 283 | canvas_set_color(canvas, ColorBlack);
|
275 | 284 | }
|
276 | 285 | static bool main_menu_view_input_callback(InputEvent* event, void* context) {
|
|
0 commit comments