Commit Graph

3 Commits

Author SHA1 Message Date
Adolfo 1a1e391a14 docs(LuaGame): update README with audio, FPS 17.5, Pico compatibility
- Document SfxEngine audio mapping
- Document 4.5x ball speed, 17.5 FPS after direct FB font
- Document Pico API shim (renderer, game, INPUT) and 17 games portability
- Tested Pong runs with no Lua errors
2026-07-31 12:57:12 -04:00
Adolfo 88870d7ac5 feat(LuaGame): Pico API compatibility layer + 17 games ported
- Added renderer, game, INPUT tables mapping Pico monochrome API to RGB565 framebuffer
  - renderer.clear, pixel, line, rect, circle, triangle (filled via scanline), text, text_scaled (8x8 font scaled)
  - game.width/height, vars, set_frame_updates, exit
  - INPUT constants NONE, TOUCH_DOWN/MOVE/UP, BUTTON_0/1, FRAME_TICK, GESTURE
- Event generation: touch down/move/up detection + FRAME_TICK each frame
- is_pico detection via source content (renderer./INPUT.) and game.vars heuristic
- Unified game loop handling both sys API (update(dt)) and Pico API (update(event))
- Generated pico_games.h with all 17 examples from pico-bare-metal:
  2048, air_hockey, asteroids, ball, breakout, counter, flappy_bird, lunar_lander,
  memory_match, pacman, pong, simon_says, snake, solitaire, tetris, tic_tac_toe
- Tested: Pong runs at 17 FPS, 'Pong initialized' log, no Lua errors
- Fixes: renamed breakout_lua_src to embedded_breakout_lua_src to avoid conflict with pico breakout
- Ready for game selector UI (menu wrapper) - currently embedded breakout fast v2 remains default, pico test flag use_pico_test available for dev
2026-07-31 12:56:53 -04:00
Adolfo 827fdb41c2 feat(LuaGame): Lua interpreter game engine with audio, 17 FPS, 4.5x ball speed
- Embed Lua 5.4.7 source to avoid missing symbols (clearerr, clock, getenv, etc)
- Provide local stubs for missing libc and avoid unexported LVGL cache APIs
- Fix float handling in sys.* bindings (checknumber vs checkinteger)
- Move Lua init and game loop to dedicated 16K FreeRTOS task to avoid GUI 4K stack overflow
- Implement sys API: clear, print (8x8 bitmap font direct FB), rect, circle, line, touch, sfx, tone
- Audio via SfxEngine (SfxId mapping, playNote for tone)
- Ball speed 2 -> 4.5, FPS counter (~17 FPS after direct FB text optimization)
- Supports loading from /sdcard/lua/breakout.lua and embedded fallback
- Verified symbols: 0 missing, builds esp32s3, installs on 192.168.68.107
2026-07-31 12:52:02 -04:00