Skip to content

Commit

Permalink
Only use shaders when available (Don't load shaders on android)
Browse files Browse the repository at this point in the history
  • Loading branch information
GuglioIsStupid committed Jun 6, 2024
1 parent aaf4d2a commit d671c3f
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
7 changes: 5 additions & 2 deletions src/main.lua
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ masterVolume = 50
isLoading = false
__DEBUG__ = not love.filesystem.isFused()
if not __DEBUG__ then
function print() end -- disable print if not in debug mode, allows for better performance
function print() end -- disable print if not in debug mode, allows for better performance (because writing to io is very slow)
end

if love.filesystem.getInfo("__VERSION__.txt") then
Expand Down Expand Up @@ -113,7 +113,10 @@ function love.load(args)
GameInit.LoadDefaultFonts()
states = GameInit.LoadStates()
substates = GameInit.LoadSubstates()
shaders = GameInit.LoadShaders()

if love.system.getOS() ~= "Android" and love.system.getOS() ~= "iOS" then
shaders = GameInit.LoadShaders()
end

-- Parse the skin's data file
skinData = ini.parse(love.filesystem.read(skin:format("skin.ini")))
Expand Down
8 changes: 6 additions & 2 deletions src/states/game/Gameplay.lua
Original file line number Diff line number Diff line change
Expand Up @@ -720,7 +720,9 @@ function Gameplay:enter()

end

shaders.backgroundEffects:send("dim", Settings.options["General"].backgroundDim)
if shaders and shaders.backgroundEffects then
shaders.backgroundEffects:send("dim", Settings.options["General"].backgroundDim)
end
--shaders.backgroundEffects:send("blurIntensity", 0)

Timer.after(1.2, function() -- forced delay to prevent potential desync's
Expand Down Expand Up @@ -1047,7 +1049,9 @@ function Gameplay:draw()
if self.background and musicTime >= 0 then
-- background dim is 0-1, 0 being no dim, 1 being full dim
--love.graphics.setColor(1, 1, 1, Settings.options["General"].backgroundDim)
love.graphics.setShader(shaders.backgroundEffects)
if shaders and shaders.backgroundEffects then
love.graphics.setShader(shaders.backgroundEffects)
end
love.graphics.draw(self.background.image or self.background, 0, 0, 0, 1920/self.background:getWidth(), 1080/self.background:getHeight())
love.graphics.setShader()
end
Expand Down

0 comments on commit d671c3f

Please sign in to comment.