Add Lua 5.4 scripting integration for dynamic game loading
- Integrated Lua 5.4 engine (32-bit mode for embedded ARM) - Created LuaGame wrapper class implementing Game interface - Added C++ bindings exposing renderer, game state, and input to Lua - Implemented SD card loader for automatic .lua game discovery - Updated GameLauncher to support std::function for lambda captures - Made Game class members public for Lua bindings access - Added example Lua games: counter, snake, bouncing ball - Included comprehensive API documentation Games can now be written as .lua text files on SD card and loaded without recompilation. Build size: 747KB UF2, Lua VM uses ~50-80KB RAM.
This commit is contained in:
@@ -8,6 +8,7 @@
|
||||
|
||||
#include <stdint.h>
|
||||
#include <vector>
|
||||
#include <functional>
|
||||
#include "input_event.h"
|
||||
#include "game.h"
|
||||
|
||||
@@ -22,8 +23,7 @@ class InputManager;
|
||||
struct GameEntry {
|
||||
const char* name; // Display name
|
||||
const char* description; // Short description
|
||||
Game* (*factory)(uint16_t width, uint16_t height,
|
||||
LowLevelRenderer* renderer, LowLevelGUI* gui, InputManager* input_manager); // Factory function
|
||||
std::function<Game*(uint16_t, uint16_t, LowLevelRenderer*, LowLevelGUI*, InputManager*)> factory; // Factory function
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -51,10 +51,10 @@ public:
|
||||
* @brief Register a game in the launcher
|
||||
* @param name Game display name
|
||||
* @param description Short description
|
||||
* @param factory Function pointer to create game instance
|
||||
* @param factory Function or lambda to create game instance
|
||||
*/
|
||||
void register_game(const char* name, const char* description,
|
||||
Game* (*factory)(uint16_t, uint16_t, LowLevelRenderer*, LowLevelGUI*, InputManager*));
|
||||
std::function<Game*(uint16_t, uint16_t, LowLevelRenderer*, LowLevelGUI*, InputManager*)> factory);
|
||||
|
||||
/**
|
||||
* @brief Draw the launcher menu
|
||||
|
||||
Reference in New Issue
Block a user