Added support for backgrounds that are not 1280x960

This commit is contained in:
Ishaan Bhardwaj
2023-07-16 01:49:26 -04:00
parent 1556b247fe
commit 2166a3c6d8
12 changed files with 26 additions and 61 deletions

View File

@@ -197,4 +197,17 @@ misc_graphics = {
strike = love.graphics.newImage("res/img/strike.png"),
santa = love.graphics.newImage("res/img/santa.png"),
icon = love.graphics.newImage("res/img/cambridge_transparent.png")
}
}
-- utility function to allow any size background to be used
-- this will stretch the background to 4:3 aspect ratio
function drawBackground(id)
local bg_object = fetchBackgroundAndLoop(id)
local width = bg_object:getWidth()
local height = bg_object:getHeight()
love.graphics.draw(
bg_object,
0, 0, 0,
640 / width, 480 / height
)
end