LoveFrames and scaling

Questions about the LÖVE API, installing LÖVE and other support related questions go here.
Forum rules
Before you make a thread asking for help, read this.
Post Reply
fatimahauck
Prole
Posts: 1
Joined: Sat Jan 16, 2021 11:14 am

LoveFrames and scaling

Post by fatimahauck » Sat Jan 16, 2021 11:43 am

I'm doing a pixel styled game with 320 x 180 resolution. I draw all my stuff on a canvas, then scale it up to the users resolution like 1920 x 1080. Workes very well, but I want to add UI using LoveFrames now.
Of cause when scaling up the mouse position isn't correct anymore. I figured out some problems can be fixed by add the scale to the LoveFrames.BoundingBox function. But there are still a lot af issues using the ColumnList, textinput and so on.
Seems like love doesn't have some kind of virtual resolution like BlitzMax/Monkey2 has. That would be the deal!

Does someone got an good idea for a good workaround?

User avatar
4vZEROv
Party member
Posts: 115
Joined: Wed Jan 02, 2019 8:44 pm

Re: LoveFrames and scaling

Post by 4vZEROv » Sun Jan 17, 2021 12:07 pm

Use 2 canvas, one where you draw you game that will be upscaled and one where you draw you UI stuff that will stay the same.

Code: Select all

game_canvas = love.graphics.newCanvas()
ui_canvas      = love.graphics.newCanvas()

function love.draw() 
	love.graphics.setCanvas(game_canvas)
		-- draw game
	love.graphics.setCavas(ui_canvas)
		-- draw ui
	love.graphics.draw(game_canvas, 0, 0, _, scale) 
	love.graphics.draw(ui_canvas)
end

Post Reply

Who is online

Users browsing this forum: GVovkiv and 61 guests