I have been wanting an easy way to to handle screen scaling since I started using love but was never able to get any of the libraries I found to work. I finally found the time to actually work on one today and this is the result.
It handles integer and non-integer scaling, stretching, and multiple monitors.
Further documentation is in the display.lua
The only bug I know of is trying to set the screen to supported modes of a different aspect ratio. This may be a linux issue though. If I set my 16:10 monior to a 4:3 resolution its seems to scale fine.
Added loveframes to control all the scaling options.
Simple Screen Scaler
Simple Screen Scaler
- Attachments
-
- ScaleTest.love
- (172.98 KiB) Downloaded 247 times
Last edited by Cluke009 on Fri May 16, 2014 1:05 pm, edited 4 times in total.
Re: Simple Screen Scaler
Updated the love file with something that others might find more useful for testing purposes. You can change all the display options through loveframes now.
I also found another bug where if your are in fullscreen and go from stretch to scale with fsaa=0 there are artifacts from the stretched image. With fsaa=0 the display doesnt seem to do a complete refresh after the changes are applied. Anybody know what causes this?
I also found another bug where if your are in fullscreen and go from stretch to scale with fsaa=0 there are artifacts from the stretched image. With fsaa=0 the display doesnt seem to do a complete refresh after the changes are applied. Anybody know what causes this?
Re: Simple Screen Scaler
Demo does not seem to be doing anything? It just displays one image and that's it.
My boat driving game demo: https://dusoft.itch.io/captain-bradley- ... itius-demo
Re: Simple Screen Scaler
1. When you switch too fullscreen, the image is centered.dusoft wrote:Demo does not seem to be doing anything? It just displays one image and that's it.
2. When you switch too fullscreen and your screen is twice as the gamescreen, the gamescreen is also scaled twice.
3. When you move the window to another screen and switch to fullscreen, it recognices this and shows the fullscreen on this monitor instead of your primary.
@Cluke009
Well done i would say (btw. the love file is not updated.)
I wrote a blogpost about this some time ago and I also implemented it by myself.
http://crankgaming.blogspot.de/2013/01/ ... aling.html
An alternative is also TLfres from Theal.
You should also add the mouse handling to it or at least a tip how to handle mouse when scaled to pick the right position.
Re: Simple Screen Scaler
TLFres does not work with Love2d 0.9.x, it needs to be updated to reflect changes in the window functions.
I have actually created such scaling for my game based on the notion that once ported to Android, the hardcoded resolution and the sizes of objects would just make mess.
Does this library support everything drawn via love.graphics.xxx or just the images?
I have actually created such scaling for my game based on the notion that once ported to Android, the hardcoded resolution and the sizes of objects would just make mess.
Does this library support everything drawn via love.graphics.xxx or just the images?
My boat driving game demo: https://dusoft.itch.io/captain-bradley- ... itius-demo
Re: Simple Screen Scaler
Everything between 'set' und 'unset' i would say.
Code: Select all
display.set()
love.graphics.draw(bg)
display.unset()
Re: Simple Screen Scaler
Cool, I will try it and report if anything spotted.
My boat driving game demo: https://dusoft.itch.io/captain-bradley- ... itius-demo
Re: Simple Screen Scaler
I actually read your article a while back and used it to help me decide on a good resolution for my game, it was very informative.SiENcE wrote:@Cluke009
Well done i would say (btw. the love file is not updated.)
I wrote a blogpost about this some time ago and I also implemented it by myself.
http://crankgaming.blogspot.de/2013/01/ ... aling.html
An alternative is also TLfres from Theal.
You should also add the mouse handling to it or at least a tip how to handle mouse when scaled to pick the right position.
Love file should be updated now, not sure what happened before. TLfres was actually the first thing I looked at and I couldnt get it to work even after updating the function calls.
Had not considered mouse integration since my game only uses keyboard and joystick. I will look into it. This is still a work in progress so if anyone finds any wierd scenerios where things don't work as expected feel free to post it and I will do my best to get things working.
Re: Simple Screen Scaler
Thanks for taking my post as inspiration .
Yes, TLfres does not work for all possibilities. I also had to modify it to fit my needs.
What about putting it to github, choose a license (zlib?) and do a nice readme :-) ? I would like to integate it into my love2d game_template.
Yes, TLfres does not work for all possibilities. I also had to modify it to fit my needs.
What about putting it to github, choose a license (zlib?) and do a nice readme :-) ? I would like to integate it into my love2d game_template.
Who is online
Users browsing this forum: No registered users and 1 guest