Compare commits

...

5 Commits

Author SHA1 Message Date
Ishaan Bhardwaj
2a21484137 Bump version to v0.3.4 2023-07-16 02:02:55 -04:00
Ishaan Bhardwaj
50410958f0 Re-add clamp for backgrounds beyond the limit 2023-07-16 01:54:20 -04:00
Ishaan Bhardwaj
6fb583e463 Typo fix 2023-07-16 01:52:02 -04:00
Ishaan Bhardwaj
91c8dc3dcc Bump version to v0.3.3.3 2023-07-16 01:50:42 -04:00
Ishaan Bhardwaj
2166a3c6d8 Added support for backgrounds that are not 1280x960 2023-07-16 01:49:26 -04:00
13 changed files with 29 additions and 64 deletions

View File

@ -8,7 +8,7 @@ image_formats = {".png", ".jpg"}
bgpath = "res/backgrounds/" bgpath = "res/backgrounds/"
dir = love.filesystem.getDirectoryItems(bgpath) dir = love.filesystem.getDirectoryItems(bgpath)
local backgrounds = {} backgrounds = {}
local function loadExtendedBgs() local function loadExtendedBgs()
extended_bgs = require("res.backgrounds.extend_section_bg") extended_bgs = require("res.backgrounds.extend_section_bg")
@ -197,4 +197,17 @@ misc_graphics = {
strike = love.graphics.newImage("res/img/strike.png"), strike = love.graphics.newImage("res/img/strike.png"),
santa = love.graphics.newImage("res/img/santa.png"), santa = love.graphics.newImage("res/img/santa.png"),
icon = love.graphics.newImage("res/img/cambridge_transparent.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

View File

@ -1 +1 @@
version = "v0.3.3.2" version = "v0.3.4"

View File

@ -30,11 +30,7 @@ function CreditsScene:render()
local offset = self.frames / self.scroll_speed local offset = self.frames / self.scroll_speed
love.graphics.setColor(1, 1, 1, 1) love.graphics.setColor(1, 1, 1, 1)
love.graphics.draw( drawBackground(19)
fetchBackgroundAndLoop(id),
0, 0, 0,
0.5, 0.5
)
love.graphics.setFont(font_3x5_4) love.graphics.setFont(font_3x5_4)
love.graphics.print("Cambridge Credits", 320, 500 - offset) love.graphics.print("Cambridge Credits", 320, 500 - offset)

View File

@ -45,11 +45,7 @@ end
function ConfigScene:render() function ConfigScene:render()
love.graphics.setColor(1, 1, 1, 1) love.graphics.setColor(1, 1, 1, 1)
love.graphics.draw( drawBackground("options_game")
fetchBackgroundAndLoop("options_game"),
0, 0, 0,
0.5, 0.5
)
love.graphics.setFont(font_3x5_4) love.graphics.setFont(font_3x5_4)
love.graphics.print("GAME SETTINGS", 80, 40) love.graphics.print("GAME SETTINGS", 80, 40)

View File

@ -20,11 +20,7 @@ function ConfigScene:update() end
function ConfigScene:render() function ConfigScene:render()
love.graphics.setColor(1, 1, 1, 1) love.graphics.setColor(1, 1, 1, 1)
love.graphics.draw( drawBackground("options_input")
fetchBackgroundAndLoop("options_input"),
0, 0, 0,
0.5, 0.5
)
love.graphics.setFont(font_3x5_4) love.graphics.setFont(font_3x5_4)
love.graphics.print("INPUT CONFIG", 80, 40) love.graphics.print("INPUT CONFIG", 80, 40)

View File

@ -45,11 +45,7 @@ end
function KeyConfigScene:render() function KeyConfigScene:render()
love.graphics.setColor(1, 1, 1, 1) love.graphics.setColor(1, 1, 1, 1)
love.graphics.draw( drawBackground("input_config")
fetchBackgroundAndLoop("input_config"),
0, 0, 0,
0.5, 0.5
)
love.graphics.setFont(font_3x5_2) love.graphics.setFont(font_3x5_2)
for i, input in ipairs(configurable_inputs) do for i, input in ipairs(configurable_inputs) do

View File

@ -58,11 +58,7 @@ function ModeSelectScene:update()
end end
function ModeSelectScene:render() function ModeSelectScene:render()
love.graphics.draw( drawBackground(0)
fetchBackgroundAndLoop(0),
0, 0, 0,
0.5, 0.5
)
love.graphics.draw(misc_graphics["select_mode"], 20, 40) love.graphics.draw(misc_graphics["select_mode"], 20, 40)

View File

@ -78,11 +78,7 @@ function ReplaySelectScene:update()
end end
function ReplaySelectScene:render() function ReplaySelectScene:render()
love.graphics.draw( drawBackground(0)
fetchBackgroundAndLoop(0),
0, 0, 0,
0.5, 0.5
)
-- Same graphic as mode select -- Same graphic as mode select
--love.graphics.draw(misc_graphics["select_mode"], 20, 40) --love.graphics.draw(misc_graphics["select_mode"], 20, 40)

View File

@ -29,11 +29,7 @@ function SettingsScene:update() end
function SettingsScene:render() function SettingsScene:render()
love.graphics.setColor(1, 1, 1, 1) love.graphics.setColor(1, 1, 1, 1)
love.graphics.draw( drawBackground("options_game")
fetchBackgroundAndLoop("options_game"),
0, 0, 0,
0.5, 0.5
)
love.graphics.setFont(font_3x5_4) love.graphics.setFont(font_3x5_4)
love.graphics.print("SETTINGS", 80, 40) love.graphics.print("SETTINGS", 80, 40)

View File

@ -46,11 +46,7 @@ end
function StickConfigScene:render() function StickConfigScene:render()
love.graphics.setColor(1, 1, 1, 1) love.graphics.setColor(1, 1, 1, 1)
love.graphics.draw( drawBackground("options_input")
fetchBackgroundAndLoop("options_input"),
0, 0, 0,
0.5, 0.5
)
love.graphics.setFont(font_3x5_2) love.graphics.setFont(font_3x5_2)
for i, input in ipairs(configurable_inputs) do for i, input in ipairs(configurable_inputs) do

View File

@ -73,11 +73,7 @@ local block_offsets = {
function TitleScene:render() function TitleScene:render()
love.graphics.setFont(font_3x5_4) love.graphics.setFont(font_3x5_4)
love.graphics.setColor(1, 1, 1, 1 - self.snow_bg_opacity) love.graphics.setColor(1, 1, 1, 1 - self.snow_bg_opacity)
love.graphics.draw( drawBackground("title_no_icon") -- title, title_night
fetchBackgroundAndLoop("title_no_icon"), -- title, title_night
0, 0, 0,
0.5, 0.5
)
-- 490, 192 -- 490, 192
for _, b in ipairs(block_offsets) do for _, b in ipairs(block_offsets) do
@ -99,11 +95,7 @@ function TitleScene:render()
love.graphics.setFont(font_3x5_2) love.graphics.setFont(font_3x5_2)
love.graphics.setColor(1, 1, 1, self.snow_bg_opacity) love.graphics.setColor(1, 1, 1, self.snow_bg_opacity)
love.graphics.draw( drawBackground("snow")
fetchBackgroundAndLoop("snow"),
0, 0, 0,
0.5, 0.5
)
love.graphics.draw( love.graphics.draw(
misc_graphics["santa"], misc_graphics["santa"],

View File

@ -34,11 +34,7 @@ end
function TuningScene:render() function TuningScene:render()
love.graphics.setColor(1, 1, 1, 1) love.graphics.setColor(1, 1, 1, 1)
love.graphics.draw( drawBackground("options_game")
fetchBackgroundAndLoop("options_game"),
0, 0, 0,
0.5, 0.5
)
love.graphics.setColor(1, 1, 1, 0.5) love.graphics.setColor(1, 1, 1, 0.5)
love.graphics.rectangle("fill", 75, 98 + self.highlight * 75, 400, 33) love.graphics.rectangle("fill", 75, 98 + self.highlight * 75, 400, 33)

View File

@ -980,13 +980,9 @@ end
function GameMode:drawBackground() function GameMode:drawBackground()
local id = self:getBackground() local id = self:getBackground()
-- if type(id) == "number" then id = clamp(id, 0, #backgrounds) end if type(id) == "number" then id = clamp(id, 0, #backgrounds) end
love.graphics.setColor(1, 1, 1, 1) love.graphics.setColor(1, 1, 1, 1)
love.graphics.draw( drawBackground(id)
fetchBackgroundAndLoop(id),
0, 0, 0,
0.5, 0.5
)
end end
function GameMode:drawFrame() function GameMode:drawFrame()