Scale games on both axes and 2x text size

All 4 games (simon_says, tic_tac_toe, memory_match, 2048):
- Changed sizing to use min(width, height) instead of just width
- Grids now scale proportionally on both axes
- All UI text now uses text_scale=2 for better visibility
- Games fill more of the screen properly on portrait mode

Fixes:
- Simon Says buttons now square grid on any orientation
- Tic-Tac-Toe grid centered vertically using full screen height
- Memory Match cards use smallest dimension for square sizing
- 2048 tiles scale and center on both axes
- All text (scores, menus, game over) now 2x larger
This commit is contained in:
Adolfo Reyna
2026-02-12 21:23:34 -05:00
parent a274fb04a1
commit fa7d2fd32f
4 changed files with 59 additions and 53 deletions

View File

@@ -13,8 +13,9 @@ local WAIT_DURATION = 20 -- Frames between shows
-- Button positions (calculated dynamically based on screen size)
local function get_buttons()
local padding = math.floor(game.width() / 10)
local button_size = math.floor((game.width() - padding * 3) / 2)
local padding = math.floor(math.min(game.width(), game.height()) / 10)
local available = math.min(game.width(), game.height()) - (padding * 3)
local button_size = math.floor(available / 2)
local spacing = padding
return {
@@ -147,9 +148,9 @@ function draw()
local buttons = get_buttons()
if state == STATE_MENU then
renderer.text(game.width() / 2 - 40, game.height() / 2 - 40, "SIMON SAYS", true)
renderer.text(game.width() / 2 - 50, game.height() / 2 - 10, "Repeat the sequence", true)
renderer.text(game.width() / 2 - 50, game.height() / 2 + 20, "Tap to Start", true)
renderer.text(game.width() / 2 - 40, game.height() / 2 - 40, "SIMON SAYS", true, 2)
renderer.text(game.width() / 2 - 50, game.height() / 2 - 10, "Repeat the sequence", true, 2)
renderer.text(game.width() / 2 - 50, game.height() / 2 + 20, "Tap to Start", true, 2)
else
-- Draw buttons with highlight
@@ -160,16 +161,16 @@ function draw()
end
-- Draw score
renderer.text(10, 10, "Level: " .. tostring(game.vars.score + 1), true)
renderer.text(10, 10, "Level: " .. tostring(game.vars.score + 1), true, 2)
if state == STATE_PLAYING and game.vars.waiting_for_input then
renderer.text(game.width() / 2 - 40, game.height() - 20, "Your turn!", true)
renderer.text(game.width() / 2 - 40, game.height() - 20, "Your turn!", true, 2)
end
if state == STATE_GAME_OVER then
renderer.text(game.width() / 2 - 40, game.height() / 2 - 20, "GAME OVER", true)
renderer.text(game.width() / 2 - 30, game.height() / 2, "Level: " .. tostring(game.vars.score + 1), true)
renderer.text(game.width() / 2 - 60, game.height() / 2 + 20, "Tap to Restart", true)
renderer.text(game.width() / 2 - 40, game.height() / 2 - 20, "GAME OVER", true, 2)
renderer.text(game.width() / 2 - 30, game.height() / 2, "Level: " .. tostring(game.vars.score + 1), true, 2)
renderer.text(game.width() / 2 - 60, game.height() / 2 + 20, "Tap to Restart", true, 2)
end
end
end