At the moment I use https://github.com/a327ex/STALKER-X but I do think it is overkill and it's not doing what I want.
So I removed it try to make it more simple.
What I do is making the pixel 'art' in Photoshop with a minimal height 180px the width is dynamic , for now I use 480px.
Now I do this, and scaling is working.
But what todo when there are 'weird' resolutions ?, I guess to center the canvas when the height don't fit exactly ?
I don't allow portrait mode in the final game version, I guess I don't allow mobile phones either. Or in other words I think that I work/test with minimal 720px height. Maybe that is not a correct minimal height, I don't know
But is this a good starting point ?
I push the scaleCanvas variable to the mouseXY, and probably need to do this in other places.
If this is correct, than I can try following the player to the left / right.
config.lua
Code: Select all
t.window.width = 800 -- The window width (number)
t.window.height = 720 -- The window height (number)
t.window.minwidth = 800 -- Minimum window width if the window is resizable (number)
t.window.minheight = 720 -- Minimum window height if the window is resizable (number)
Code: Select all
love.graphics.setDefaultFilter("nearest", "nearest")
love.graphics.setLineStyle("rough")
scaleCanvas = 720px / 180px (min height photoshop drawing) = 4
function love.draw()
love.graphics.setCanvas(self.canvas)
love.graphics.clear()
// draw everthing
love.graphics.setCanvas()
love.graphics.draw(self.canvas, 0, 0, 0, scaleCanvas, scaleCanvas)
end
function love.mousepressed(ox, oy, button, istouch, presses)
self.world:mousePressedEvent({
x = math.floor(x/scaleCanvas),
y = math.floor(y/scaleCanvas),
button = button,
istouch = istouch,
presses = presses,
ox = ox - self:getCanvasX(),
oy = oy - self:getCanvasY()
})
end