36 lines
1.2 KiB
C++
36 lines
1.2 KiB
C++
// Copy of game_launcher.h for emulator build
|
|
#include <stdint.h>
|
|
#include <vector>
|
|
#include "input_event.h"
|
|
#include "game.h"
|
|
class LowLevelRenderer;
|
|
class LowLevelGUI;
|
|
class InputManager;
|
|
struct GameEntry {
|
|
const char* name;
|
|
const char* description;
|
|
Game* (*factory)(uint16_t width, uint16_t height, LowLevelRenderer* renderer, LowLevelGUI* gui, InputManager* input_manager);
|
|
};
|
|
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, Game* (*factory)(uint16_t, uint16_t, LowLevelRenderer*, LowLevelGUI*, InputManager*));
|
|
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;
|
|
static const int MENU_Y_START = 60;
|
|
static const int MENU_ITEM_HEIGHT = 40;
|
|
static const int MENU_PADDING = 10;
|
|
};
|