Better controller code

This commit is contained in:
2024-07-14 18:23:07 +02:00
parent a6a2d19ff8
commit 7811684bad
5 changed files with 34 additions and 9 deletions

View File

@@ -4,12 +4,29 @@ local function getTextY(line)
end
function love.draw2()
local width, height = love.graphics.getDimensions()
-- Set background
love.graphics.setBackgroundColor(0, 0, 0)
love.graphics.setColor(1, 1, 1)
-- Draw camera feed
if BotState.camfeed then
love.graphics.draw(BotState.camfeed)
local imageWidth = BotState.camfeed:getWidth()
local imageHeight = BotState.camfeed:getHeight()
local scaleWidth = width / imageWidth
local scaleHeight = height / imageHeight
local scale = math.min(scaleWidth, scaleHeight)
local scaledWidth = imageWidth * scale
local scaledHeight = imageHeight * scale
love.graphics.draw(BotState.camfeed,
(width - scaledWidth) / 2, (height - scaledHeight) / 2,
0,
scale, scale
)
end
-- Draw time