Simple Screen Scaler

Showcase your libraries, tools and other projects that help your fellow love users.
User avatar
Cluke009
Prole
Posts: 15
Joined: Tue Aug 20, 2013 7:13 pm

Simple Screen Scaler

Post by Cluke009 »

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.
Screenshot20140512101517.png
Screenshot20140512101517.png (130.69 KiB) Viewed 7425 times
Attachments
ScaleTest.love
(172.98 KiB) Downloaded 264 times
Last edited by Cluke009 on Fri May 16, 2014 1:05 pm, edited 4 times in total.
User avatar
markgo
Party member
Posts: 190
Joined: Sat Jan 05, 2013 12:21 am
Location: USA

Re: Simple Screen Scaler

Post by markgo »

Sounds cool, but the demo doesn't show much.
User avatar
Cluke009
Prole
Posts: 15
Joined: Tue Aug 20, 2013 7:13 pm

Re: Simple Screen Scaler

Post by Cluke009 »

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?
User avatar
dusoft
Party member
Posts: 655
Joined: Fri Nov 08, 2013 12:07 am
Location: Europe usually
Contact:

Re: Simple Screen Scaler

Post by dusoft »

Demo does not seem to be doing anything? It just displays one image and that's it.
User avatar
SiENcE
Party member
Posts: 806
Joined: Thu Jul 24, 2008 2:25 pm
Location: Berlin/Germany
Contact:

Re: Simple Screen Scaler

Post by SiENcE »

dusoft wrote:Demo does not seem to be doing anything? It just displays one image and that's it.
1. When you switch too fullscreen, the image is centered.
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.
User avatar
dusoft
Party member
Posts: 655
Joined: Fri Nov 08, 2013 12:07 am
Location: Europe usually
Contact:

Re: Simple Screen Scaler

Post by dusoft »

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?
User avatar
SiENcE
Party member
Posts: 806
Joined: Thu Jul 24, 2008 2:25 pm
Location: Berlin/Germany
Contact:

Re: Simple Screen Scaler

Post by SiENcE »

Everything between 'set' und 'unset' i would say.

Code: Select all

    display.set()
    love.graphics.draw(bg)
    display.unset()
User avatar
dusoft
Party member
Posts: 655
Joined: Fri Nov 08, 2013 12:07 am
Location: Europe usually
Contact:

Re: Simple Screen Scaler

Post by dusoft »

Cool, I will try it and report if anything spotted.
User avatar
Cluke009
Prole
Posts: 15
Joined: Tue Aug 20, 2013 7:13 pm

Re: Simple Screen Scaler

Post by Cluke009 »

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.
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.

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.
User avatar
SiENcE
Party member
Posts: 806
Joined: Thu Jul 24, 2008 2:25 pm
Location: Berlin/Germany
Contact:

Re: Simple Screen Scaler

Post by SiENcE »

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.
Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests