Files
basic1/emulator/game_launcher.h
Adolfo Reyna b5e69abc83 Add virtual navigation buttons to game launcher
- Display < PREV and NEXT > buttons at bottom of screen when multiple pages exist
- Buttons are touchable and respond to taps
- Button dimensions: 150x40 at y=235
- PREV button: x=30, NEXT button: x=200
- Updated instructions to show 'Touch buttons or KEY0/KEY1'
- Both KEY0/KEY1 and touch button presses navigate pages
- Updated lib/ and emulator/ versions
2026-02-12 20:46:41 -05:00

56 lines
1.6 KiB
C++

// Copy of game_launcher.h for emulator build
#include <stdint.h>
#include <vector>
#include <functional>
#include "input_event.h"
#include "game.h"
class LowLevelRenderer;
class LowLevelGUI;
class InputManager;
struct GameEntry {
const char* name;
const char* description;
std::function<Game*(uint16_t, uint16_t, LowLevelRenderer*, LowLevelGUI*, InputManager*)> factory;
};
class GameLauncher {
public:
GameLauncher(uint16_t width, uint16_t height, LowLevelRenderer* renderer, LowLevelGUI* gui, InputManager* input_manager);
void register_game(const char* name, const char* description,
std::function<Game*(uint16_t, uint16_t, LowLevelRenderer*, LowLevelGUI*, InputManager*)> factory);
void draw();
bool update(const InputEvent& event);
Game* get_selected_game();
void reset();
bool is_game_selected() const { return selected_game != nullptr; }
private:
uint16_t width;
uint16_t height;
LowLevelRenderer* renderer;
LowLevelGUI* gui;
InputManager* input_manager;
std::vector<GameEntry> games;
int selected_index;
Game* selected_game;
int current_page;
static const int MENU_Y_START = 60;
static const int MENU_ITEM_HEIGHT = 40;
static const int MENU_PADDING = 10;
static const int GAMES_PER_PAGE = 4;
static const int NAV_BUTTON_Y = 235;
static const int PREV_BUTTON_X = 30;
static const int NEXT_BUTTON_X = 200;
static const int BUTTON_WIDTH = 150;
static const int BUTTON_HEIGHT = 40;
int get_total_pages() const;
int get_page_start_index() const;
int get_page_end_index() const;
};