-
Notifications
You must be signed in to change notification settings - Fork 144
Description
When the game dimensions are a different aspect ratio than the screen dimensions, all canvases are drawn shifted relative to what they should be. It was an issue that was bugging me for a while, and pgimeno on the love2d forums helped me resolve it.
This only happens when the canvases are drawn in love.update (it works fine if the canvases are drawn in love.load).
pgimeno helped me resolve the issue by adding love.graphics.origin() before i draw the canvas. This resolves the issue, but the behaviour is still not what I'dve expect, so it might be considered a bug.
Example:
This should a 1280x720 blue rectangle over a 1280x720 game (when the screen is 1500x720):
The conf.lua
function love.conf(t)
t.window.width = 1500
t.window.height = 720
endThe main.lua:
push = require("push")
local gameWidth, gameHeight = 1280,720
local windowWidth, windowHeight = love.window.getMode()
push:setupScreen(gameWidth,gameHeight,windowWidth,windowHeight,{fullscreen=false})
function love.update(dt)
thisCanvas = love.graphics.newCanvas(1280,720)
love.graphics.setCanvas(thisCanvas)
love.graphics.clear()
love.graphics.setColor(0,1,1,1)
love.graphics.rectangle('fill',0,0,1280,720)
love.graphics.setColor(1,1,1,1)
love.graphics.setCanvas()
end
function love.draw()
push:start()
love.graphics.rectangle('line',1,1,1280,720)
love.graphics.draw(thisCanvas,0,0)
push:finish()
endThe canvas (blue) appears shifted right relative to where it should be by 110px (which is the same as how much the game is shifted relative to the screen, but this is an extra 110px on top of that).