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

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: 1440
Joined: Sun Oct 18, 2015 2:58 pm

Re: Needing help with scaling.

Post by pgimeno » Sat Jan 12, 2019 12:54 pm

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 :)
Thrust II Reloaded - GifLoad for Löve - GSpöt GUI - My NotABug.org repositories - portland (mobile orientation)
The MS-Github repositories I had have been closed after the acquisition announcement and will be removed in the near future.

User avatar
NobodysSon
Prole
Posts: 27
Joined: Tue Oct 30, 2012 10:37 pm

Re: Needing help with scaling.

Post by NobodysSon » Sat Jan 12, 2019 6:18 pm

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 4 guests