Skip to content

Commit

Permalink
api_demo: add backgrounds to text so it is legible in dark mode
Browse files Browse the repository at this point in the history
  • Loading branch information
alexbarry committed Aug 9, 2024
1 parent 8b55b1f commit 434f296
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/lua_scripts/games/api_demo/game_draw.lua
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,8 @@ function draw.draw(state)
local y_pos = text_size + padding
local x_pos = padding

-- Draw text on the screen
-- Draw text on the screen, with a background
alexgames.draw_rect("#88888888", 0, 0, y_pos + padding, g_board_width)
alexgames.draw_text(msg, text_color,
y_pos, x_pos,
text_size,
Expand Down Expand Up @@ -137,6 +138,8 @@ function draw.draw(state)

-- Show text indicating user input to help debug, also
-- explain to user how they can provide input to move the ball.
-- Draw a background first, so the text is visible in light or dark mode
alexgames.draw_rect("#88888888", g_board_height - 3*padding - 2*text_size, 0, g_board_height, g_board_width)
if state.mouse_down then
alexgames.draw_text(string.format('Mouse pos: {y=%3.0f, x=%3.0f}', state.user_input_pos_y, state.user_input_pos_x), text_color,
g_board_height - padding, padding,
Expand Down

0 comments on commit 434f296

Please sign in to comment.