Created
January 8, 2017 20:41
-
-
Save serpent7776/a8d6a628d6fb5418362d596732a40e8f to your computer and use it in GitHub Desktop.
Revisions
-
serpent7776 created this gist
Jan 8, 2017 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,24 @@ function love.load() screenWidth = love.graphics.getWidth() screenHeight = love.graphics.getHeight() canvas = love.graphics.newCanvas(screenWidth, screenHeight) end function love.draw(dt) -- draw to canvas love.graphics.setCanvas(canvas) local w = screenWidth / 2 love.graphics.setBlendMode('alpha') -- draw cyan rect on the left love.graphics.setColor(0, 255, 255) love.graphics.rectangle('fill', 0, 0, w, screenHeight) -- draw yellow rect on the right love.graphics.setColor(255, 255, 0) love.graphics.rectangle('fill', w, 0, w, screenHeight) love.graphics.setCanvas() -- blit canvas to screen love.graphics.clear() love.graphics.setBlendMode("alpha", "premultiplied") love.graphics.draw(canvas) -- after drawing canvas to screen, left rect is green end