Fix render issues with fonts

This commit is contained in:
Adolfo Reyna
2026-01-30 22:02:15 -05:00
parent e3445b545d
commit 436245a7a2
5 changed files with 30 additions and 17 deletions

View File

@@ -4,6 +4,7 @@
// Menu system for selecting and launching games
#include "game_launcher.h"
#include "board_config.h"
#include "display/low_level_render.h"
#include "display/low_level_gui.h"
#include <stdio.h>
@@ -27,27 +28,25 @@ void GameLauncher::register_game(const char* name, const char* description,
void GameLauncher::draw() {
// Draw main window
gui->draw_new_window(10, 10, width - 20, height - 20, "Game Launcher");
LowLevelWindow* window = gui->draw_new_window(10, 10, width - 20, height - 20, "Game Launcher");
renderer->set_font(&font_5x5_obj);
// Draw title
renderer->draw_string(30, 30, "Select a Game:", true);
renderer->draw_string_scaled(30, 40, "Select a Game:", 2);
// Draw game list
// Draw game list with GUI buttons
for (size_t i = 0; i < games.size(); i++) {
int y = MENU_Y_START + (i * MENU_ITEM_HEIGHT);
// Highlight selected item
if ((int)i == selected_index) {
// Draw selection box
renderer->draw_rectangle(20, y - 5, width - 40, MENU_ITEM_HEIGHT - 10, true, 2);
renderer->draw_string(30, y + 2, ">", true);
}
// Draw button (pressed/highlighted if selected)
bool is_selected = ((int)i == selected_index);
gui->draw_button(window, 20, y, games[i].name, is_selected, true);
// Draw game name
renderer->draw_string(45, y + 2, games[i].name, true);
// Draw description (smaller, below name)
renderer->draw_string(45, y + 15, games[i].description, true);
// Draw description below button
renderer->set_font(&font_5x5_obj); // Restore small font for description
renderer->set_text_color(true); // Normal text color
renderer->draw_string_scaled(50, y + 36, games[i].description, 1);
}
// Draw instructions at bottom
@@ -57,7 +56,8 @@ void GameLauncher::draw() {
#else
instructions = "Touch game to play";
#endif
renderer->draw_string(30, height - 35, instructions, true);
renderer->set_font(&font_5x5_obj);
renderer->draw_string_scaled(30, height - 35, instructions, 2);
}
bool GameLauncher::update(const InputEvent& event) {