Resizing game window to a lower size

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
User avatar
molul
Party member
Posts: 264
Joined: Sun Feb 05, 2012 6:51 pm
Location: Valencia, Spain
Contact:

Resizing game window to a lower size

Post by molul »

My project is 1280x720, and I more or less know how to make it compatible with 4:3 and 16:10 screens, but I'm wondering, what if the resolution is lower? Could I just resize all the game's window to a lower resolution (kind of "zooming out")? Has anybody tried something like that?
User avatar
pk
Citizen
Posts: 67
Joined: Wed Dec 14, 2011 2:13 am
Location: Texas, United States
Contact:

Re: Resizing game window to a lower size

Post by pk »

https://love2d.org/wiki/love.graphics.setMode

You can set modes here. I'd recommend supporting the default LOVE resolution of 800x600 as a bare minimum if you can.
ALL CREATURE WILL DIE AND ALL THE THINGS WILL BE BROKEN. THAT'S THE LAW OF SAMURAI.
User avatar
molul
Party member
Posts: 264
Joined: Sun Feb 05, 2012 6:51 pm
Location: Valencia, Spain
Contact:

Re: Resizing game window to a lower size

Post by molul »

Sorry, I didn't explain myself well. If I setMode to 800x600, the viewport will be smaller and thus, the game will look bigger than in a 1280x720 screen. My question is if it's possible to resize the whole stuff being drawn into the viewport, so when I do setMode(800x600), I'd see the game exactly the same as in a 1280x720 screen (in terms of proportion).
User avatar
pk
Citizen
Posts: 67
Joined: Wed Dec 14, 2011 2:13 am
Location: Texas, United States
Contact:

Re: Resizing game window to a lower size

Post by pk »

https://love2d.org/wiki/love.graphics.scale

Are you talking about scaling? You can scale down graphics to less than %100. It won't look good but...

[edit]
Or are you talking about displaying a 16:9 widescreen image at a lower resolution?
ALL CREATURE WILL DIE AND ALL THE THINGS WILL BE BROKEN. THAT'S THE LAW OF SAMURAI.
coffee
Party member
Posts: 1206
Joined: Wed Nov 02, 2011 9:07 pm

Re: Resizing game window to a lower size

Post by coffee »

molul wrote:Sorry, I didn't explain myself well. If I setMode to 800x600, the viewport will be smaller and thus, the game will look bigger than in a 1280x720 screen. My question is if it's possible to resize the whole stuff being drawn into the viewport, so when I do setMode(800x600), I'd see the game exactly the same as in a 1280x720 screen (in terms of proportion).
I understand your problems. I had some earlier thoughts and tests about that because my rpg will do kind of adaptative response (à la webdesign) if screen map size/tilesize changes and info areas are turned on/off.

EDITED: For other words in my rpg all screensize will resize depending wanted map/tile size, so display areas also resize. For the tests I done it's possible resize for smaller screens (until our eyes can't longer read it well of course).

I think the concept it's doable if you draw and assign a global variable scale to all your objects. Changing the global scale var would do the trick if map/char draws engines are also prepared to calculate where to draw accordding global scale. However working with TTF text for resize areas is more complicated. But if text areas are prepared things can work well.
Last edited by coffee on Thu Mar 08, 2012 1:19 pm, edited 1 time in total.
User avatar
kikito
Inner party member
Posts: 3153
Joined: Sat Oct 03, 2009 5:22 pm
Location: Madrid, Spain
Contact:

Re: Resizing game window to a lower size

Post by kikito »

There was definitively a library for that. Wasn't it TLSomething?

Also, take into account that you can't show exactly the same thing. When screens have different aspect ratios you can't exactly do that. You either "distort" your images, add "ugly black borders", or just show a bit more content in some screens (which is my preference).

EDIT: Found the lib in question: TLfres. Apparently it handles the "squewing" thing and everything. I haven't tried it myself, but Taehl's libs are usually good.
When I write def I mean function.
User avatar
felix24
Party member
Posts: 163
Joined: Tue Jul 26, 2011 4:51 pm
Contact:

Re: Resizing game window to a lower size

Post by felix24 »

here's how i do it. get the current height of your window and divide that by 720 in your case. this will leave you with the amount to scale by.

eg:

Code: Select all

scaleAmount = love.graphics.getHeight()/720
to get the amount to translate by just do this:

Code: Select all

transAmount = love.graphics.getHeight() * (1-scaleAmount)
then in your draw function have:

Code: Select all

love.graphics.push()
love.graphics.translate(0 , transAmount )
love.graphics.scale(scaleAmount,scaleAmount)

**your code**

love.graphics.pop()
this will leave the graphics size/window size ratio the same. however on 4:3 aspect ratio, there will be less if the level visible than on wide screen.

......or you could just use TLfres if that will do the work for you ;)
User avatar
molul
Party member
Posts: 264
Joined: Sun Feb 05, 2012 6:51 pm
Location: Valencia, Spain
Contact:

Re: Resizing game window to a lower size

Post by molul »

Coooool. Thank you all. I'll test it when I get home :)
Post Reply

Who is online

Users browsing this forum: Google [Bot] and 199 guests