From 9e995e482dcd862384d24901ee5acabe83565e3e Mon Sep 17 00:00:00 2001 From: GuglioIsStupid Date: Tue, 2 Jul 2024 17:18:39 -0400 Subject: [PATCH] some more funcs and f ixes --- src/love/modules/Icon.lua | 2 +- src/love/modules/camera.lua | 1 + src/love/modules/graphics.lua | 41 +++++++++++++++++++++++++---------- src/love/states/weeks.lua | 2 +- 4 files changed, 32 insertions(+), 14 deletions(-) diff --git a/src/love/modules/Icon.lua b/src/love/modules/Icon.lua index 66c3192c..29ab84d4 100644 --- a/src/love/modules/Icon.lua +++ b/src/love/modules/Icon.lua @@ -1,6 +1,6 @@ return { imagePath = function(path) - return graphics.imagePath("icons/icon-" .. path) + return graphics.imagePath("icons/icon-" .. (path or "bf")) end, newIcon = function(path, scale) if not graphics.cache[path] then diff --git a/src/love/modules/camera.lua b/src/love/modules/camera.lua index 6d3f4900..0f45087f 100644 --- a/src/love/modules/camera.lua +++ b/src/love/modules/camera.lua @@ -8,6 +8,7 @@ camera.zooming = true camera.locked = false camera.camBopIntensity = 1 camera.camBopInterval = 4 +camera.lockedMoving = false camera.esizeX = 1 camera.esizeY = 1 diff --git a/src/love/modules/graphics.lua b/src/love/modules/graphics.lua index 5595d38d..9c23b4bf 100644 --- a/src/love/modules/graphics.lua +++ b/src/love/modules/graphics.lua @@ -112,6 +112,7 @@ return { scrollY = 1, visible = true, + alpha = 1, setImage = function(self, image) image = image @@ -131,6 +132,10 @@ return { return height end, + setScale = function(self, scale) + self.sizeX, self.sizeY = scale, scale + end, + draw = function(self) local x = self.x local y = self.y @@ -140,6 +145,9 @@ return { y = math.floor(y) end + local lastColor = {love.graphics.getColor()} + graphics.setColor(lastColor[1], lastColor[2], lastColor[3], lastColor[4] * self.alpha) + if self.visible then love.graphics.draw( image, @@ -154,6 +162,8 @@ return { self.shearY ) end + + love.graphics.setColor(lastColor[1], lastColor[2], lastColor[3]) end, udraw = function(self, sx, sy) @@ -167,18 +177,25 @@ return { y = math.floor(y) end - love.graphics.draw( - image, - self.x, - self.y, - self.orientation, - sx, - sy, - math.floor(width / 2) + self.offsetX, - math.floor(height / 2) + self.offsetY, - self.shearX, - self.shearY - ) + local lastColor = {love.graphics.getColor()} + graphics.setColor(lastColor[1], lastColor[2], lastColor[3], lastColor[4] * self.alpha) + + if self.visible then + love.graphics.draw( + image, + self.x, + self.y, + self.orientation, + sx, + sy, + math.floor(width / 2) + self.offsetX, + math.floor(height / 2) + self.offsetY, + self.shearX, + self.shearY + ) + end + + love.graphics.setColor(lastColor[1], lastColor[2], lastColor[3]) end } diff --git a/src/love/states/weeks.lua b/src/love/states/weeks.lua index 907bda99..e56ba170 100644 --- a/src/love/states/weeks.lua +++ b/src/love/states/weeks.lua @@ -808,7 +808,7 @@ return { for i, event in ipairs(songEvents) do if event.time <= absMusicTime then - if event.name == "FocusCamera" then + if event.name == "FocusCamera" and camera.lockedMoving then if type(event.value) == "number" then if event.value == 0 then -- Boyfriend camera:moveToPoint(1.25, "boyfriend")