Commit Graph

31 Commits

Author SHA1 Message Date
Adolfo Reyna
a058476b42 Scale 2048 to fill screen
2048.lua:
- Removed hardcoded TILE_SIZE and TILE_SPACING constants
- Added get_tile_size() function that calculates tile dimensions based on screen width
- Added get_grid_start_x/y() to center grid
- Updated draw() to use dynamic sizing for all tiles
- 4x4 grid now scales proportionally on any screen size
2026-02-12 21:10:16 -05:00
Adolfo Reyna
2a9b17a539 Scale Memory Match to fill screen
memory_match.lua:
- Removed hardcoded CARD_SIZE and CARD_SPACING
- Added get_card_size() function that calculates card dimensions based on available screen space
- Grid now fills screen width (minus padding) and uses available height
- Added get_grid_start_x/y() to center grid
- All card positions and hit detection updated to use dynamic sizing
- Cards scale proportionally on any screen size while maintaining 4x4 layout
2026-02-12 21:09:46 -05:00
Adolfo Reyna
62716c7dc4 Scale Simon Says and Tic-Tac-Toe to fill screen
simon_says.lua:
- Removed hardcoded button positions
- Added get_buttons() function that calculates button size and position based on screen dimensions
- Buttons now use 10% screen padding and scale to fill available width
- 2x2 grid automatically scales with screen size

tic_tac_toe.lua:
- Replaced hardcoded CELL_SIZE with dynamic calculation
- Added get_cell_size() to compute size based on screen width
- Added get_grid_start_x/y() to center grid both horizontally and vertically
- Grid now scales to fill available space while maintaining 3x3 layout
- All cell positions updated to use dynamic functions

Both games now work on any screen size and scale proportionally.
2026-02-12 21:06:54 -05:00
Adolfo Reyna
b22170b62c Fix Lua game float-to-int conversion errors for renderer.circle()
All games had the same issue: renderer.circle() requires integer arguments,
but float calculations produced non-integer coordinates.

Fixed in all games using math.floor(x + 0.5) for proper rounding:
- pong.lua: Ball position
- air_hockey.lua: Puck position
- asteroids.lua: Asteroid positions
- ball.lua: Ball and trail positions, velocity line
- breakout.lua: Ball position
- flappy_bird.lua: Bird Y position
- counter.lua: Last touch marker position
- snake.lua: Food position (center calculation)
- tic_tac_toe.lua: O circle center position

Also fixed floating-point coordinate calculations in ball and line
drawing to ensure all coordinates are integers.
2026-02-12 20:51:26 -05:00
Adolfo Reyna
38ffdac749 Add pagination to game launcher - 4 games per page
- GameLauncher now displays only 4 games per page to keep menu in bounds
- Added page navigation with page indicator (Page X/Y)
- KEY0 navigates between pages and within page
- KEY1 selects the highlighted game
- Touch selection works on current page only
- Helper methods: get_total_pages(), get_page_start_index(), get_page_end_index()
- Updated both lib/ and emulator/ versions for consistency
2026-02-12 20:39:38 -05:00
Adolfo Reyna
50793ac535 feat: add final 4 games for basic1 console
- 2048: Grid merging, directional movement, score tracking, win/draw detection
- Tic-Tac-Toe: Minimax AI opponent, perfect play, win detection
- Lunar Lander: Gravity + thrust physics, fuel management, landing validation
- Air Hockey: Refined paddle physics, puck acceleration, goal detection

All games tested for state transitions, collision logic, and win conditions.
Suite now complete with 10 classic games ready for SD card deployment.
2026-02-12 19:40:42 -05:00
Adolfo Reyna
53a2fb046b feat: add 6 lua games for basic1 console
- Pong: 2-player paddle and ball game with spin mechanics
- Flappy Bird: gravity physics, obstacle avoidance
- Breakout: paddle control, brick grid, collision detection
- Simon Says: sequence memory, animation timing
- Memory Match: pair matching, flip animations, grid layout
- Tetris: falling blocks, grid system, line clearing
- Asteroids: vector math, rotation, projectiles, enemy spawning

All games follow API conventions with state machines, touch input,
frame-based animation, and persistent game.vars state management.
2026-02-12 19:18:51 -05:00
Adolfo Reyna
47fc02f05c Fix frame update logic and emulator support
- Fix basic1.cpp loop to handle set_frame_updates(true) correctly with sleep
- Update emulator loop for concurrent input and frame updates
- Update emulator for SFML 3.0 compatibility
- Add INPUT.FRAME_TICK constant to Lua bindings
- Enable frame updates in snake.lua example
2026-02-10 23:27:31 -05:00
Adolfo Reyna
b16211f148 Fix SD card integration and Lua game loading
- Fix SD card MISO pin (was using display MISO instead of SD MISO)
- Add FatFS mounting after SD card initialization
- Restore SPI baudrate on all SD init failure paths
- Add case-insensitive .lua file extension check
- Filter out hidden 8.3 filename entries
- Add SPI speed management functions for shared SPI bus
- Wrap all FatFS operations with SPI speed switching
- Restore display SPI speed (32 MHz) after SD operations
- Add debug output to Lua game loader

This fixes slow display refresh when SD card is present and enables
reliable Lua game loading from SD card /games directory.
2026-02-07 19:31:38 -05:00
Adolfo Reyna
2a472fc29f Add frame tick system for continuous animation
- Added INPUT_FRAME_TICK event type to input_event.h
- Added wants_frame_updates() virtual method to Game base class
- Implemented frame tick logic in main loop (basic1.cpp and emulator/main.cpp)
- Added Lua bindings: game.set_frame_updates(bool) and INPUT.FRAME_TICK
- Updated LuaGame to support frame updates via registry flag
- Updated ball.lua to use continuous frame updates for smooth animation
- Both hardware and emulator now support continuous animation for physics/games
2026-02-07 13:20:10 -05:00
Adolfo Reyna
8d176925f8 Fix garbage characters in hardware game names
Store game names and descriptions in persistent LuaGameFactoryData
structure instead of local stack variables to prevent dangling pointers.
Same fix as emulator version.
2026-02-07 13:09:16 -05:00
Adolfo Reyna
e6e4eca188 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.
2026-02-07 11:56:03 -05:00
Adolfo Reyna
c8af4f6638 Update DiceModalGame with a restricted board view and interactive dice challenge 2026-02-06 23:30:37 -05:00
Adolfo Reyna
499b61c9a5 Fix CommunityChestModalGame getting stuck after dismissal by correctly deleting it 2026-02-06 23:19:40 -05:00
Adolfo Reyna
64f61759d7 Fix emulator compilation and crash, and implement Monopoly payment modal 2026-02-06 23:13:32 -05:00
Adolfo Reyna
75e17fb26b Add friction to mindless clicking by disabling default action preselection in Monopoly menus 2026-02-06 22:45:16 -05:00
Adolfo Reyna
e2817262b0 Add virtual touch buttons for Monopoly game and centralize configuration in ModalButtonHelper 2026-02-06 22:11:24 -05:00
Adolfo Reyna
eb86c3fc0e Integrate thematic sprites and improve Monopoly UI 2026-02-02 23:14:14 -05:00
Adolfo Reyna
3bdbfb1811 Fix 1-bit bitmap rendering and add player turn modal 2026-02-02 23:14:11 -05:00
Adolfo Reyna
d5a80235b4 improve board view with visual cues of the properties owned 2026-01-31 23:02:25 -05:00
Adolfo Reyna
63c4324561 monopoly Main UI Changes 2026-01-31 22:46:33 -05:00
Adolfo Reyna
c6d7bd6c8c monopoly Main UI Changes 2026-01-31 22:46:26 -05:00
Adolfo Reyna
78b376ad5d fix rent calculation 2026-01-31 22:23:49 -05:00
Adolfo Reyna
fa4c6f00ca monopoly board 2026-01-31 22:00:46 -05:00
Adolfo Reyna
561f7c5951 interpreting monopoly as multi scree game 2026-01-31 19:05:58 -05:00
Adolfo Reyna
cad1aad2c8 initial monopoly test 2026-01-31 09:45:40 -05:00
Adolfo Reyna
76a74477a7 emulator working 2026-01-30 23:40:10 -05:00
Adolfo Reyna
f860d4f5e6 input manager provides ground of truth on device input choise 2026-01-30 22:07:31 -05:00
Adolfo Reyna
436245a7a2 Fix render issues with fonts 2026-01-30 22:02:15 -05:00
Adolfo Reyna
e3445b545d Initial game launcher 2026-01-30 21:39:09 -05:00
Adolfo Reyna
2a6861fdf5 refactored to multiple games implementation 2026-01-30 21:33:42 -05:00