Properly display balls and strikes #3

Merged
sage merged 2 commits from proper-balls-and-strikes-display into main 2025-02-07 20:11:54 -05:00
1 changed files with 3 additions and 2 deletions
Showing only changes of commit e44bdcb57b - Show all commits

View File

@ -6,8 +6,9 @@ local ScoreboardHeight <const> = 55
local Indicator = "> "
local IndicatorWidth <const> = ScoreFont:getTextWidth(Indicator)
local BallStrikeMarginY <const> = 4
local BallStrikeWidth <const> = 60
local BallStrikeHeight <const> = 20
local BallStrikeHeight <const> = (BallStrikeMarginY * 2) + ScoreFont:getHeight()
---@param teams any
---@param battingTeam any
@ -33,7 +34,7 @@ function drawBallsAndStrikes(x, y, balls, strikes)
local text = tostring(balls) .. " - " .. tostring(strikes)
local textWidth = ScoreFont:getTextWidth(text)
local widthDiff = BallStrikeWidth - textWidth
Review

Where does the magic 4 come from 🤔

Where does the magic 4 come from 🤔
Review

You're honestly so real for that

You're honestly so real for that
ScoreFont:drawText(text, x + (widthDiff / 2), y + 4)
ScoreFont:drawText(text, x + (widthDiff / 2), y + BallStrikeMarginY)
gfx.setImageDrawMode(originalDrawMode)
end