How to scale up the game correctly
Posted: Sun Sep 18, 2022 1:33 am
I've made my game whit a 420p resolution and i want to scale the game to work the same whit differents window size,how could i make it?What's all my choice?
Please explain the game visual art and how you want to upscale it.
Well (at least for now) it's just drawing shape/text. I want the game to be the same whatever window size you have so that the game plays the same.
Please try the multiresolution,soytak111 wrote: ↑Sun Sep 18, 2022 3:24 pmWell (at least for now) it's just drawing shape/text. I want the game to be the same whatever window size you have so that the game plays the same.
Code: Select all
local MR = require ('multiresolution')
function love.load()
-- window size:
love.window.setMode(1920, 1080, {resizable = true, borderless = false})
-- native resolution:
MR.load(560, 420) -- target/native rendering resolution
-- load code here
end
function love.update(dt)
-- update code here
end
function love.draw()
MR.draw()
MR.drawTestBackground () -- example background
-- draw code here
love.graphics.setColor(1,1,1)
love.graphics.print (MR.getMouseX()..' '..MR.getMouseY(), 0, 0)
end
function love.resize ()
MR.resize()
end
function love.mousepressed( x, y, button, istouch, presses )
x, y = MR.getMousePosition()
-- code here
end
function love.mousemoved( x, y, dx, dy, istouch )
x, y = MR.getMousePosition()
-- code here
end
function love.mousereleased( x, y, button, istouch, presses )
x, y = MR.getMousePosition()
-- code here
end
function love.keypressed(key, scancode, isrepeat)
MR.keypressed(key, scancode, isrepeat)
if false then
elseif key == "escape" then
love.event.quit()
end
end
or check "resolution solution" https://github.com/Vovkiv/resolution_solution...
I don't quite understand where to put code,can you explain it in more details please?darkfrei wrote: ↑Sun Sep 18, 2022 7:14 pm
Please try the multiresolution,
the main.lua for it:But fonts must be changed with respect to MR.scaleCode: Select all
local MR = require ('multiresolution') function love.load() -- window size: love.window.setMode(1920, 1080, {resizable = true, borderless = false}) -- native resolution: MR.load(560, 420) -- target/native rendering resolution -- load code here end function love.update(dt) -- update code here end function love.draw() MR.draw() MR.drawTestBackground () -- example background -- draw code here love.graphics.setColor(1,1,1) love.graphics.print (MR.getMouseX()..' '..MR.getMouseY(), 0, 0) end function love.resize () MR.resize() end function love.mousepressed( x, y, button, istouch, presses ) x, y = MR.getMousePosition() -- code here end function love.mousemoved( x, y, dx, dy, istouch ) x, y = MR.getMousePosition() -- code here end function love.mousereleased( x, y, button, istouch, presses ) x, y = MR.getMousePosition() -- code here end function love.keypressed(key, scancode, isrepeat) MR.keypressed(key, scancode, isrepeat) if false then elseif key == "escape" then love.event.quit() end end
multiresolution.lua