From 937f24699ce35a0c42b67c0fa8c1de8b9947b6a0 Mon Sep 17 00:00:00 2001 From: Aki Date: Sat, 16 Jul 2016 05:13:47 +0200 Subject: Sprites color keying and new sprites --- main.lua | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'main.lua') diff --git a/main.lua b/main.lua index 9be9eda..aa24c08 100644 --- a/main.lua +++ b/main.lua @@ -2,17 +2,33 @@ -- WHOLE CODE HAS FLAG OF "need a cleanup" -- Pretend you didn't see this +-- This is work for scene manager Scene = nil function changeScene(scene) Scene = scene end +-- Should be moved to scene/camera function getScale() return math.max(1, math.floor(love.graphics.getWidth() / 320)-1, math.floor(love.graphics.getHeight() / 180)-1) end function getRealScale() return math.max(love.graphics.getWidth() / 320, love.graphics.getHeight() / 180) end +-- Should be moved anywhere; engine object +function newImage(path) + local imagedata = love.image.newImageData(path) + local transparency = function(x, y, r, g, b, a) + if (r == 0 and g == 128 and b == 64) or + (r == 0 and g == 240 and b == 6) then + a = 0 + end + return r, g, b, a + end + imagedata:mapPixel(transparency) + local image = love.graphics.newImage(imagedata) + return image +end -- Require require "world" -- cgit v1.1