Closed ravener closed 1 year ago
I tried to reproduce your case with this code (with resizable = true
and fullscreen = true
at love.conf
):
local textlog = {}
local function addLog(text)
table.insert(textlog, 1, text)
textlog[6] = nil
end
function love.load()
refreshrate = select(3, love.window.getMode()).refreshrate or 0
addLog(refreshrate.."Hz "..string.format("%dx%d", love.graphics.getDimensions()))
end
function love.draw()
love.graphics.print(table.concat(textlog, "\n"), 32, 32)
end
function love.resize(w, h)
addLog("new resize "..w.."x"..h)
end
function love.keyreleased(k)
if k == "escape" then love.event.quit() end
end
And I can confirm it indeed fires love.resize
event just after love.load
. My best guess is this is caused by love2d/love@9c4db00e9490742317d4a493f5c11d7f7e200124, but that commit is there to workaround love2d/love-android#196 so this is confusion on its own.
Probably not gonna fixed in 11.x.
Currently the workaround is to manually set fullscreen love.window.setFullscreen(true)
inside love.load
instead of using fullscreen = true
. This works as expected.
I'm quite confused about how screen resolutions is handled and I found that in
love.load
I have a smaller width/height returned bylove.graphics.getWidth()/getHeight()
but immediately afterlove.resize
is called with the correct values. Is this an expected behavior or a bug? Lots of examples and code around initialize stuff inlove.load
which if they usedlove.graphics.getWidth()/getHeight
they'd all be working with smaller values than the actual size.If this is the expected way, can't we somehow make it so atleast the initial
love.resize
is called before we get tolove.load
? What's the best way to deal with sizes in this manner?