From 4e4d61f7375f660c29943964c33f9c43983582a3 Mon Sep 17 00:00:00 2001 From: flamendless Date: Wed, 30 May 2018 11:24:08 +0800 Subject: [PATCH] updated color range to be compatible for 11.1 --- conf.lua | 2 +- lib/normal_map.lua | 2 +- lib/postshader.lua | 2 +- main.lua | 28 ++++++++++++++-------------- 4 files changed, 17 insertions(+), 17 deletions(-) diff --git a/conf.lua b/conf.lua index cd080d0..6d117b0 100644 --- a/conf.lua +++ b/conf.lua @@ -1,6 +1,6 @@ function love.conf(t) t.identity = nil -- The name of the save directory (string) - t.version = "0.10.0" -- The LÖVE version this game was made for (string) + t.version = "11.1" -- The LÖVE version this game was made for (string) t.console = true -- Attach a console (boolean, Windows only) t.window.title = "Untitled" -- The window title (string) diff --git a/lib/normal_map.lua b/lib/normal_map.lua index d679e93..eecc833 100644 --- a/lib/normal_map.lua +++ b/lib/normal_map.lua @@ -48,7 +48,7 @@ function normal_map.fromHeightMap(heightMap, strength) end function normal_map.generateFlat(img, mode) - local imgData = img:getData() + local imgData = love.image.newImageData(img:getWidth(), img:getHeight()) local imgNormalData = love.image.newImageData(img:getWidth(), img:getHeight()) local color diff --git a/lib/postshader.lua b/lib/postshader.lua index 2541e8c..ee55f55 100644 --- a/lib/postshader.lua +++ b/lib/postshader.lua @@ -27,7 +27,7 @@ local util = require(_PACKAGE..'/util') local post_shader = {} post_shader.__index = post_shader -local files = love.filesystem.getDirectoryItems(_PACKAGE.."/shaders/postshaders") +local files = love.filesystem.getInfo(_PACKAGE .. "/shaders/postshaders") local shaders = {} for i,v in ipairs(files) do diff --git a/main.lua b/main.lua index 000feff..0fe66b2 100644 --- a/main.lua +++ b/main.lua @@ -63,10 +63,10 @@ function exf.draw() lightWorld:draw(function() love.graphics.setBackgroundColor(0, 0, 0) - love.graphics.setColor(48, 156, 225) + love.graphics.setColor(48/255, 156/255, 225/255) love.graphics.rectangle("fill", 0, 0, love.graphics.getWidth(), love.graphics.getHeight()) - love.graphics.setColor(255, 255, 255, 191) + love.graphics.setColor(1, 1, 1, 191/255) love.graphics.setFont(exf.bigfont) love.graphics.print("Examples:", 50, 50) @@ -75,7 +75,7 @@ function exf.draw() exf.list:draw() - love.graphics.setColor(255, 255, 255) + love.graphics.setColor(1, 1, 1) love.graphics.draw(exf.bigball, 800 - 128, 600 - 128, love.timer.getTime(), 1, 1, exf.bigball:getWidth() * 0.5, exf.bigball:getHeight() * 0.5) end) end @@ -158,7 +158,7 @@ end function exf.clear() love.graphics.setBackgroundColor(0,0,0) - love.graphics.setColor(255, 255, 255) + love.graphics.setColor(1, 1, 1) love.graphics.setLineWidth(1) love.graphics.setLineStyle("smooth") love.graphics.setBlendMode("alpha") @@ -182,11 +182,11 @@ function exf.resume() -- create light world lightWorld = LightWorld({ - ambient = {127, 127, 127} + ambient = {127/255, 127/255, 127/255} }) -- create light - lightMouse = lightWorld:newLight(0, 0, 255, 127, 63, 500) + lightMouse = lightWorld:newLight(0, 0, 1, 127/255, 63/255, 500) lightMouse:setSmooth(2) -- create shadow bodys @@ -337,7 +337,7 @@ function List:draw() love.graphics.setLineStyle("rough") love.graphics.setFont(self.font) - love.graphics.setColor(48, 156, 225) + love.graphics.setColor(48/255, 156/255, 1) local mx, my = love.mouse.getPosition() @@ -357,17 +357,17 @@ function List:draw() local hover = inside(mx, my, x, y, w, h) if hover then - love.graphics.setColor(0, 0, 0, 127) + love.graphics.setColor(0, 0, 0, 127/255) else - love.graphics.setColor(0, 0, 0, 63) + love.graphics.setColor(0, 0, 0, 63/255) end love.graphics.rectangle("fill", x+1, y+i+1, w-3, h) if hover then - love.graphics.setColor(255, 255, 255) + love.graphics.setColor(1, 1, 1, 1) else - love.graphics.setColor(255, 255, 255, 127) + love.graphics.setColor(1, 1, 1, 127/255) end local e_id = string.sub(self.items[i], 1, 5) @@ -385,15 +385,15 @@ function List:draw() local hover = inside(mx, my, x, y, w, h) if hover or self.bar_lock then - love.graphics.setColor(0, 0, 0, 127) + love.graphics.setColor(0, 0, 0, 127/255) else - love.graphics.setColor(0, 0, 0, 63) + love.graphics.setColor(0, 0, 0, 63/255) end love.graphics.rectangle("fill", x, y, w, h) end -- Border. - love.graphics.setColor(0, 0, 0, 63) + love.graphics.setColor(0, 0, 0, 63/255) love.graphics.rectangle("line", self.x+self.width, self.y, self.bar_width, self.height) love.graphics.rectangle("line", self.x, self.y, self.width, self.height) end