From 03112bb0fb783e67605e55f8833da2cd9af681d6 Mon Sep 17 00:00:00 2001 From: 0x81c Date: Thu, 12 Mar 2015 03:27:27 -0400 Subject: [PATCH] sweet glitchlove . --- conf.lua | 2 +- main.lua | 35 +++++++++++++++++++++++++++++++++-- 2 files changed, 34 insertions(+), 3 deletions(-) diff --git a/conf.lua b/conf.lua index c1dbb0a..a6a8ce4 100644 --- a/conf.lua +++ b/conf.lua @@ -1,5 +1,5 @@ function love.conf(t) - t.window.width = 900 + t.window.width = 640 t.window.height = 640 t.window.title = "CHROMA SOLSTICE" end \ No newline at end of file diff --git a/main.lua b/main.lua index 1b67658..067807b 100644 --- a/main.lua +++ b/main.lua @@ -3,15 +3,17 @@ Timer = require "libs/hump/timer" require "input" require "color" require "room" -require "player" +require "shaders" require "debug_helpers" function love.load() _initDefaults() _initGridVars() - loadSprites() + gameCanvas = love.graphics.newCanvas() + finalCanvas = love.graphics.newCanvas() + inputTimer = Timer.new() currentRoom = Room:new{ @@ -30,8 +32,37 @@ function love.update(dt) end function love.draw() + gameCanvas:clear() + finalCanvas:clear() + + love.graphics.setCanvas(gameCanvas) love.graphics.setBlendMode("screen") currentRoom:draw() + + love.graphics.setCanvas(finalCanvas) + + local scaleCoefficient = .93 + local samples = 7 + + love.graphics.push() + + for i = 1, samples do + local c = 65 / (i * 1.75) + love.graphics.setColor(c, c, c) + love.graphics.scale(scaleCoefficient, scaleCoefficient) + love.graphics.translate((width / 2 - (width * scaleCoefficient) / 2) + 2, (width / 2 - (height * scaleCoefficient) / 2) + 2) + love.graphics.draw(gameCanvas, 0, 0) + end + + love.graphics.pop() + love.graphics.setColor(255, 255, 255) + love.graphics.draw(gameCanvas, 0, 0) + love.graphics.setCanvas() + + pixelate:send("seed", math.random()) + pixelate:send("zoom", .2) + love.graphics.setShader(pixelate) + love.graphics.draw(finalCanvas, 0, 0) end function love.keypressed(key)