From 5a3387b73bb5bd85718742ab813d9df44d075cd0 Mon Sep 17 00:00:00 2001 From: Simon Larsen Date: Sun, 19 Aug 2018 11:55:41 +0200 Subject: [PATCH] =?UTF-8?q?Updated=20for=20L=C3=96VE=2011.0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- blanket.lua | 6 +++--- conf.lua | 51 +++++++++++++++++++++++++++++++++++++++++++++++- data.lua | 2 +- gameover.lua | 8 ++++---- ingame.lua | 6 +++--- introduction.lua | 8 ++++---- main.lua | 8 +++----- title.lua | 16 +++++++-------- util.lua | 8 ++++---- winscreen.lua | 14 ++++++------- 10 files changed, 87 insertions(+), 40 deletions(-) diff --git a/blanket.lua b/blanket.lua index d128a9d..1770acf 100644 --- a/blanket.lua +++ b/blanket.lua @@ -95,11 +95,11 @@ function Blanket:draw() local r2 = self.p[self.xpoints-1][iy].body love.graphics.line(r1:getX(), r1:getY(), r2:getX(), r2:getY()) end - love.graphics.setColor(255, 255, 255) + love.graphics.setColor(1, 1, 1) end function Blanket:mousepressed(x, y, button) - if button ~= "l" then return end + if button ~= 1 then return end if self.mousejoint then self.mousejoint:destroy() @@ -126,7 +126,7 @@ function Blanket:mousepressed(x, y, button) end function Blanket:mousereleased(x, y, button) - if button ~= "l" or self.mousejoint == nil then return end + if button ~= 1 or self.mousejoint == nil then return end self.mousejoint:destroy() self.mousejoint = nil diff --git a/conf.lua b/conf.lua index 91a954b..c719253 100644 --- a/conf.lua +++ b/conf.lua @@ -1,6 +1,6 @@ function love.conf(t) t.identity = "safetyblanket" - t.version = "0.9.2" + t.version = "11.0" t.console = false t.window.title = "Safety Blanket" @@ -23,3 +23,52 @@ function love.conf(t) t.modules.joystick = true end + +function love.conf(t) + t.identity = "safetyblanket" + t.appendidentity = false + t.version = "11.0" + t.console = false + t.accelerometerjoystick = true + t.externalstorage = false + t.gammacorrect = false + + t.audio.mixwithsystem = true + + t.window.title = "Safety Blanket" + t.window.icon = nil + t.window.width = 1024 + t.window.height = 768 + t.window.borderless = false + t.window.resizable = false + t.window.minwidth = 1 + t.window.minheight = 1 + t.window.fullscreen = false + t.window.fullscreentype = "desktop" + t.window.vsync = 1 + t.window.msaa = 0 + t.window.display = 1 + t.window.highdpi = false + t.window.x = nil + t.window.y = nil + + t.modules.audio = true + t.modules.data = true + t.modules.event = true + t.modules.font = true + t.modules.graphics = true + t.modules.image = true + t.modules.joystick = true + t.modules.keyboard = true + t.modules.math = true + t.modules.mouse = true + t.modules.physics = true + t.modules.sound = true + t.modules.system = true + t.modules.thread = true + t.modules.timer = true + t.modules.touch = true + t.modules.window = true + + t.modules.video = false +end diff --git a/data.lua b/data.lua index b13160b..c3da14d 100644 --- a/data.lua +++ b/data.lua @@ -12,7 +12,7 @@ function updateScore(time, completed) end function loadScore() - if love.filesystem.exists("score") == false then + if love.filesystem.getInfo("score") == nil then return {time = 0, completed = false} end local strdata = love.filesystem.read("score") diff --git a/gameover.lua b/gameover.lua index b490cfc..0808f9b 100644 --- a/gameover.lua +++ b/gameover.lua @@ -48,14 +48,14 @@ function GameOver:draw() printfShadow("Click to try again", 0, HEIGHT-20, WIDTH, "center", 1) if self.fade > 0 then - local alpha = math.min(255, self.fade*255) + local alpha = math.min(1, self.fade) love.graphics.setColor(0, 0, 0, alpha) love.graphics.rectangle("fill", 0, 0, WIDTH, HEIGHT) - love.graphics.setColor(255, 255, 255) + love.graphics.setColor(1, 1, 1, 1) end local mx, my = love.mouse.getPosition() - if love.mouse.isDown("l") then + if love.mouse.isDown(1) then love.graphics.draw(self.imgCursorPinch, mx, my, 0, 1, 1, 4, 12) else love.graphics.draw(self.imgCursorNormal, mx, my, 0, 1, 1, 4, 12) @@ -70,7 +70,7 @@ function GameOver:mousepressed(x, y, button) end function GameOver:mousereleased(x, y, button) - if button == "l" and self.state == GameOver.STATE_FADEIN and self.fade < 0.5 then + if button == 1 and self.state == GameOver.STATE_FADEIN and self.fade < 0.5 then self.state = GameOver.STATE_FADEOUT self.fade = math.max(0, self.fade) ResMgr.playSound("pageturn.wav") diff --git a/ingame.lua b/ingame.lua index 2f1426b..9e98f18 100644 --- a/ingame.lua +++ b/ingame.lua @@ -111,13 +111,13 @@ function Ingame:draw() self.demon:draw() if self.fade > 0 then - love.graphics.setColor(255, 255, 255, self.fade*255) + love.graphics.setColor(1, 1, 1, self.fade) love.graphics.rectangle("fill", 0, 0, WIDTH, HEIGHT) - love.graphics.setColor(255, 255, 255, 255) + love.graphics.setColor(1, 1, 1, 1) end local mx, my = love.mouse.getPosition() - if love.mouse.isDown("l") then + if love.mouse.isDown(1) then love.graphics.draw(self.imgCursorPinch, mx, my, 0, 1, 1, 4, 12) else love.graphics.draw(self.imgCursorNormal, mx, my, 0, 1, 1, 4, 12) diff --git a/introduction.lua b/introduction.lua index d3ac5ea..4de4d92 100644 --- a/introduction.lua +++ b/introduction.lua @@ -45,13 +45,13 @@ function Introduction:draw() printfShadow(intro_text, 16, 14, WIDTH-32, "left", 1) if self.fade > 0 then - love.graphics.setColor(0, 0, 0, self.fade*255) + love.graphics.setColor(0, 0, 0, self.fade) love.graphics.rectangle("fill", 0, 0, WIDTH, HEIGHT) - love.graphics.setColor(255, 255, 255, 255) + love.graphics.setColor(1, 1, 1, 1) end local mx, my = love.mouse.getPosition() - if love.mouse.isDown("l") then + if love.mouse.isDown(1) then love.graphics.draw(self.imgCursorPinch, mx, my, 0, 1, 1, 4, 12) else love.graphics.draw(self.imgCursorNormal, mx, my, 0, 1, 1, 4, 12) @@ -73,7 +73,7 @@ function Introduction:mousepressed(x, y, button) end function Introduction:mousereleased(x, y, button) - if button == "l" then + if button == 1 then if self.state == Introduction.STATE_FADEIN then self.state = Introduction.STATE_FADEOUT self.fade = math.max(self.fade, 0) diff --git a/main.lua b/main.lua index ffdf413..82605cd 100644 --- a/main.lua +++ b/main.lua @@ -1,6 +1,6 @@ WIDTH = 256 HEIGHT = 192 -SCALE = 3 +SCALE = 4 ResMgr = require("resmgr") require("AnAL") @@ -24,9 +24,7 @@ function love.load() love.graphics.setLineStyle("rough") love.mouse.setVisible(false) - if love.graphics.isSupported("canvas") then - canvas = love.graphics.newCanvas(WIDTH, HEIGHT) - end + canvas = love.graphics.newCanvas(WIDTH, HEIGHT) switchState(Title) end @@ -42,8 +40,8 @@ end function love.draw() love.graphics.push() - canvas:clear() love.graphics.setCanvas(canvas) + love.graphics.clear() state:draw() love.graphics.scale(SCALE, SCALE) love.graphics.setCanvas() diff --git a/title.lua b/title.lua index 1842920..ec93172 100644 --- a/title.lua +++ b/title.lua @@ -60,29 +60,29 @@ function Title:draw() local mx, my = love.mouse.getPosition() love.graphics.draw(self.bg, 0, 0) - love.graphics.setColor(0, 0, 0, 128) + love.graphics.setColor(0, 0, 0, 0.5) love.graphics.draw(self.text[self.textFrame], 6, 14) - love.graphics.setColor(255, 255, 255, 255) + love.graphics.setColor(1, 1, 1, 1) love.graphics.draw(self.text[self.textFrame], 9, 12) if self.hasInf == true then if mx >= 208 and mx <= 249 and my >= 7 and my <= 30 then - love.graphics.setColor(255, 255, 255, 128) + love.graphics.setColor(1, 1, 1, 0.5) end self.animInf:draw(208, 7) - love.graphics.setColor(255, 255, 255, 255) + love.graphics.setColor(1, 1, 1, 1) end love.graphics.setFont(ResMgr.getFont("notalot35.ttf", 16)) printfShadow("CLICK TO CONTINUE", 10, 153, 125, "center", 2) if self.fade > 0 then - love.graphics.setColor(0, 0, 0, self.fade*255) + love.graphics.setColor(0, 0, 0, self.fade) love.graphics.rectangle("fill", 0, 0, WIDTH, HEIGHT) - love.graphics.setColor(255, 255, 255, 255) + love.graphics.setColor(1, 1, 1, 1) end - if love.mouse.isDown("l") then + if love.mouse.isDown(1) then love.graphics.draw(self.imgCursorPinch, mx, my, 0, 1, 1, 4, 12) else love.graphics.draw(self.imgCursorNormal, mx, my, 0, 1, 1, 4, 12) @@ -119,7 +119,7 @@ function Title:mousepressed(x, y, button) end function Title:mousereleased(x, y, button) - if button == "l" then + if button == 1 then if self.state == Title.STATE_FADEIN then if self.hasInf == true and x >= 208 and x <= 249 and y >= 7 and y <= 30 then self.state = Title.STATE_FADEINF diff --git a/util.lua b/util.lua index 755df04..f45ef07 100644 --- a/util.lua +++ b/util.lua @@ -37,16 +37,16 @@ end function printShadow(text, x, y, offset) local offset = offset or 1 - love.graphics.setColor(0, 0, 0, 128) + love.graphics.setColor(0, 0, 0, 0.5) love.graphics.print(text, x, y+offset) - love.graphics.setColor(255, 255, 255, 255) + love.graphics.setColor(1, 1, 1, 1) love.graphics.print(text, x, y) end function printfShadow(text, x, y, limit, align, offset) local offset = offset or 1 - love.graphics.setColor(0, 0, 0, 128) + love.graphics.setColor(0, 0, 0, 0.5) love.graphics.printf(text, x, y+offset, limit, align) - love.graphics.setColor(255, 255, 255, 255) + love.graphics.setColor(1, 1, 1, 1) love.graphics.printf(text, x, y, limit, align) end diff --git a/winscreen.lua b/winscreen.lua index 7ca185d..3c45d95 100644 --- a/winscreen.lua +++ b/winscreen.lua @@ -32,22 +32,22 @@ function Winscreen:draw() printShadow("You managed to get a good nights sleep,", 10, 8, 1) printShadow("now hurry up and get to work!", 10, 22, 1) - love.graphics.setColor(0, 0, 0, 255) + love.graphics.setColor(0, 0, 0, 0.5) love.graphics.printf("Click to continue", 0, HEIGHT-16, WIDTH, "center") - love.graphics.setColor(255, 255, 255, 255) + love.graphics.setColor(1, 1, 1, 1) if self.fade > 0 then if self.state == Winscreen.STATE_FADEIN then - love.graphics.setColor(255, 255, 255, self.fade*255) + love.graphics.setColor(1, 1, 1, self.fade) else - love.graphics.setColor(0, 0, 0, self.fade*255) + love.graphics.setColor(0, 0, 0, self.fade) end love.graphics.rectangle("fill", 0, 0, WIDTH, HEIGHT) - love.graphics.setColor(255, 255, 255, 255) + love.graphics.setColor(1, 1, 1, 1) end local mx, my = love.mouse.getPosition() - if love.mouse.isDown("l") then + if love.mouse.isDown(1) then love.graphics.draw(self.imgCursorPinch, mx, my, 0, 1, 1, 4, 12) else love.graphics.draw(self.imgCursorNormal, mx, my, 0, 1, 1, 4, 12) @@ -63,7 +63,7 @@ function Winscreen:mousepressed(x, y, button) end function Winscreen:mousereleased(x, y, button) - if button == "l" then + if button == 1 then if self.state == Winscreen.STATE_FADEIN then self.state = Winscreen.STATE_FADEOUT self.fade = math.max(self.fade, 0) -- 2.21.1