Last active
August 29, 2015 14:10
-
-
Save codeliger/68390c738ee59e1da841 to your computer and use it in GitHub Desktop.
This file contains 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 characters
local window = { | |
width = 500, | |
height = 500 | |
} | |
pixelmap = {} | |
function love.load() | |
love.window.setMode(window.width, window.height, {}); | |
love.window.setTitle("Warden") | |
love.graphics.setPointSize(200) | |
for xindex=1,window.width do | |
pixelmap[xindex] = {} | |
for yindex=1,window.height do | |
pixelmap[xindex][yindex] = {0,0,0,255} | |
end | |
end | |
end | |
function love.keypressed(key) | |
if(key == "escape") then | |
love.event.quit() | |
end | |
end | |
function love.update() | |
if(love.mouse.isDown("l")) then | |
local x, y = love.mouse.getPosition() | |
if(x > 0 and x <= window.width and y > 0 and y < window.height) then | |
pixelmap[x][y] = {255,255,255,255} | |
end | |
end | |
end | |
function love.draw() | |
for xindex=1,#pixelmap do | |
for yindex=1,#pixelmap[xindex] do | |
love.graphics.setColor(pixelmap[xindex][yindex]) | |
love.graphics.point(xindex,yindex) | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment