Resizing game window to a lower size
Forum rules
Before you make a thread asking for help, read this.
Before you make a thread asking for help, read this.
Resizing game window to a lower size
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?
Re: Resizing game window to a lower size
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.
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.
Re: Resizing game window to a lower size
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).
Re: Resizing game window to a lower size
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?
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.
Re: Resizing game window to a lower size
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.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).
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.
- 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
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.
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.
Re: Resizing game window to a lower size
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:
to get the amount to translate by just do this:
then in your draw function have:
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
eg:
Code: Select all
scaleAmount = love.graphics.getHeight()/720
Code: Select all
transAmount = love.graphics.getHeight() * (1-scaleAmount)
Code: Select all
love.graphics.push()
love.graphics.translate(0 , transAmount )
love.graphics.scale(scaleAmount,scaleAmount)
**your code**
love.graphics.pop()
......or you could just use TLfres if that will do the work for you
Re: Resizing game window to a lower size
Coooool. Thank you all. I'll test it when I get home
Who is online
Users browsing this forum: Google [Bot] and 199 guests