First working version of desktop emulator with game launcher support. Includes local stubs and launcher logic.
This commit is contained in:
35
emulator/game_launcher.h
Normal file
35
emulator/game_launcher.h
Normal file
@@ -0,0 +1,35 @@
|
||||
// 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;
|
||||
};
|
||||
Reference in New Issue
Block a user