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:
Adolfo Reyna
2026-02-07 11:56:03 -05:00
parent c8af4f6638
commit e6e4eca188
74 changed files with 29098 additions and 13 deletions

View File

@@ -53,6 +53,7 @@
#include "tic_tac_toe.h"
#include "demo_game.h"
#include "monopoly_game.h"
#include "lua_game_loader.h"
// Binary info for RP2350 - ensures proper boot image structure
@@ -363,6 +364,11 @@ int main()
return new DemoGame(w, h, r, g, im);
});
// Register Lua games from SD card /games directory
printf("\nScanning for Lua games on SD card...\n");
int lua_games_found = LuaGameLoader::register_all_games(&launcher);
printf("Found %d Lua game(s)\n", lua_games_found);
// Draw launcher menu
launcher.draw();