Page 1 of 1

Needing help with scaling.

Posted: Sat Jan 12, 2019 6:55 am
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!

Re: Needing help with scaling.

Posted: Sat Jan 12, 2019 12:54 pm
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 :)

Re: Needing help with scaling.

Posted: Sat Jan 12, 2019 6:18 pm
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.