Needing help with scaling.

General discussion about LÖVE, Lua, game development, puns, and unicorns.
Post Reply
jsiplanut
Prole
Posts: 1
Joined: Sat Jan 12, 2019 6:52 am

Needing help with scaling.

Post by jsiplanut »

Hi everyone,

I currently am making a monopoly game. However, whenever I resize my screen, the board that I have created stays the same size. I would like for it to scale depending on the size of the screen (i.e. 1024, 768 -> 1920, 1080). Is there anyway to do it?


Thanks!
User avatar
pgimeno
Party member
Posts: 3672
Joined: Sun Oct 18, 2015 2:58 pm

Re: Needing help with scaling.

Post by pgimeno »

If your code is prepared to deal with any resolution, sure. Just use the love.resize callback to be notified when the screen size changes, and adjust whatever you need to adjust.

Also, welcome to the forums :)
User avatar
NobodysSon
Prole
Posts: 33
Joined: Tue Oct 30, 2012 10:37 pm

Re: Needing help with scaling.

Post by NobodysSon »

To build a little more on what pgimeno said, in order for your code to deal with any resolution the coordinates to display your various images,text, etc should be set relative to the screen size rather than using hard coded values. For instance, if you had an 800 x 600 window and were placing a pixel in the center of it by drawing at (400,300) it would obviously not be centered anymore if the window was resized. Instead you should be placing the pixel at screen width/2. That is a very simple example but it should give you some idea. Your images can be scaled to be larger or smaller relative to the window using the various scaling functions built into LÖVE.
Post Reply

Who is online

Users browsing this forum: Bing [Bot] and 2 guests