made this so its easy to get to work on a low resolution project, dynamically scales for window mode.
hope anyone else can use this, and maybe wants to join in on that game jam.
maid64 version 1.0 maid64 version 1.1 github
maid64 version 1.5
https://github.com/adekto/maid64/tree/master/legacy
maid64 version 1.6
https://github.com/adekto/maid64
main.lua (v1.0)
Code: Select all
require "maid64"
function love.load()
--optional settings for window
love.window.setMode(640, 640, {resizable=true, vsync=false, minwidth=200, minheight=200})
--initilizing maid64 for use and set to 64x64 mode
maid64(64)
--loading test sprite
maid = love.graphics.newImage("maid64.png")
--setting the test sprite's filter so it wont do any anti-aliasing
maid:setFilter("nearest","nearest")
rotate = 0
end
function love.update(dt)
--rotation for test sprite
rotate = rotate + dt
end
function maid64_draw()
--this is where you do image drawing
--test sprite
love.graphics.draw(maid,32,32,rotate,1,1,32,32)
end
Code: Select all
function maid64(pixels)
maid64 = {}
maid64.size = pixels or 64
maid64.scaler = love.graphics.getHeight() / maid64.size
maid64.x = love.graphics.getWidth()/2-(maid64.scaler*(maid64.size/2))
maid64.y = love.graphics.getHeight()/2-(maid64.scaler*(maid64.size/2))
maid64.canvas = love.graphics.newCanvas(maid64.size, maid64.size)
maid64.canvas:setFilter("nearest","nearest")
end
function love.draw()
love.graphics.setCanvas(maid64.canvas)
love.graphics.clear()
maid64_draw()
love.graphics.setCanvas()
love.graphics.draw(maid64.canvas, maid64.x,maid64.y,0,maid64.scaler,maid64.scaler)
end
function love.resize(w, h)
if h < w then
maid64.scaler = h / maid64.size
else
maid64.scaler = w / maid64.size
end
maid64.x = w/2-(maid64.scaler*(maid64.size/2))
maid64.y = h/2-(maid64.scaler*(maid64.size/2))
end