From 5d6583938a1d7dc94d16e53da0b9ce2d5c18e997 Mon Sep 17 00:00:00 2001 From: Mystro256 Date: Sat, 19 Nov 2016 16:33:42 -0500 Subject: [PATCH] Love 0.10.0+ support --- game.lua | 6 +++--- levelbutton.lua | 4 ++-- main.lua | 12 ++++++++++-- menubutton.lua | 4 ++-- pausebutton.lua | 4 ++-- 5 files changed, 19 insertions(+), 11 deletions(-) diff --git a/game.lua b/game.lua index 2b53dbb..9d1ff60 100644 --- a/game.lua +++ b/game.lua @@ -1163,7 +1163,7 @@ function game_mousepressed(x, y, button) end print(fadegoal) - if button == "r" or button == "l" and (not gamepaused and fadegoal ~= "menu") then + if button == rbutton or button == lbutton and (not gamepaused and fadegoal ~= "menu") then updateperspective("none") rotatedrag = true rotatedragX = x @@ -1175,7 +1175,7 @@ function game_mousepressed(x, y, button) end function game_mousereleased(x, y, button) - if (button == "r" or button == "l") and love.mouse.isDown("l") == false and love.mouse.isDown("r") == false and fadegoal ~= "menu" then + if (button == rbutton or button == lbutton) and love.mouse.isDown(lbutton) == false and love.mouse.isDown(rbutton) == false and fadegoal ~= "menu" then rotatedrag = false if won == false then --check if current pitch is good @@ -1226,4 +1226,4 @@ function game_mousereleased(x, y, button) end end end -end \ No newline at end of file +end diff --git a/levelbutton.lua b/levelbutton.lua index 9fcd861..67ec5a4 100644 --- a/levelbutton.lua +++ b/levelbutton.lua @@ -184,7 +184,7 @@ function levelbutton:draw() end function levelbutton:mousepressed(x, y, button) - if self.unlocked and self.active and button == "l" then + if self.unlocked and self.active and button == lbutton then if self:gethighlight(x, y) then for i, v in pairs(levelbuttons) do v.active = false @@ -202,4 +202,4 @@ function levelbutton:gethighlight(x, y) return true end return false -end \ No newline at end of file +end diff --git a/main.lua b/main.lua index 04bc223..8422b31 100644 --- a/main.lua +++ b/main.lua @@ -27,7 +27,15 @@ 0. You just DO WHAT THE FUCK YOU WANT TO. ]] ---0.9.0 stuff +--Version compatibility stuff +major, minor, revision, codename = love.getVersion() +if major == 0 and minor <= 9 then + lbutton = "l" + rbutton = "r" +else + lbutton = 1 + rbutton = 2 +end math.mod = math.fmod if not love.graphics.drawq then love.graphics.drawq = love.graphics.draw @@ -890,4 +898,4 @@ function playsound(sound) sound:stop() sound:play() end -end \ No newline at end of file +end diff --git a/menubutton.lua b/menubutton.lua index a9a2ec6..93a73d3 100644 --- a/menubutton.lua +++ b/menubutton.lua @@ -58,7 +58,7 @@ function menubutton:draw() end function menubutton:mousepressed(x, y, button) - if self.active and button == "l" then + if self.active and button == lbutton then if self:gethighlight(x, y) then self:func() return true @@ -72,4 +72,4 @@ function menubutton:gethighlight(x, y) return true end return false -end \ No newline at end of file +end diff --git a/pausebutton.lua b/pausebutton.lua index 6997a61..6d98584 100644 --- a/pausebutton.lua +++ b/pausebutton.lua @@ -76,7 +76,7 @@ end function pausebutton:mousepressed(x, y, button) if self.active then - if button == "l" then + if button == lbutton then if self:gethighlight(x, y) then self:func() end @@ -90,4 +90,4 @@ function pausebutton:gethighlight(x, y) return true end return false -end \ No newline at end of file +end