Scäle library is finished

Showcase your libraries, tools and other projects that help your fellow love users.
Post Reply
User avatar
Tesselode
Party member
Posts: 555
Joined: Fri Jul 23, 2010 7:55 pm

Scäle library is finished

Post by Tesselode »

I made a topic about this a while ago, but it's pretty useless. I decided to finish the library, and it turns out there wasn't much left to do.

Scäle is a library that replaces the love.graphics functions with functions that keep the correct aspect ratio of the graphics no matter what the resolution is. Objects are the same distance from the center of the screen no matter what the horizontal resolution is, and they zoom in or out based on vertical resolution. This is useful for allowing games to run in multiple (and widescreen) resolutions.

To use this library, replace love.graphics functions with Scäle's counterparts and place everything where you would want it on an 800x600 window. Currently scale_circle, scale_rectangle, scale_draw, scale_line, scale_point, scale_polygon, and scale_triangle are included.

Download it here: http://tesselode.110mb.com/files/love/scale.lua

If anyone has an idea of how to scale fonts, please let me know. Also, if anyone can format the code so that everything is spaced out nicely, that would be nice too.
User avatar
RPG
Party member
Posts: 157
Joined: Wed Mar 02, 2011 5:02 am
Location: Russia
Contact:

Re: Scäle library is finished

Post by RPG »

Nice idea, i'm thinking about the same, but using love.graphics.translate.
User avatar
Robin
The Omniscient
Posts: 6506
Joined: Fri Feb 20, 2009 4:29 pm
Location: The Netherlands
Contact:

Re: Scäle library is finished

Post by Robin »

Tesselode wrote:If anyone has an idea of how to scale fonts, please let me know. Also, if anyone can format the code so that everything is spaced out nicely, that would be nice too.
love.graphics.scale works on text and images alike.
Help us help you: attach a .love.
User avatar
Tesselode
Party member
Posts: 555
Joined: Fri Jul 23, 2010 7:55 pm

Re: Scäle library is finished

Post by Tesselode »

Robin wrote:
Tesselode wrote:If anyone has an idea of how to scale fonts, please let me know. Also, if anyone can format the code so that everything is spaced out nicely, that would be nice too.
love.graphics.scale works on text and images alike.
It makes things kind of blurry, though. If you take a high-resolution image, draw it at a smaller size, and use love.graphics.scale, does it stay high-resolution?
User avatar
Taehl
Dreaming in associative arrays
Posts: 1025
Joined: Mon Jan 11, 2010 5:07 am
Location: CA, USA
Contact:

Re: Scäle library is finished

Post by Taehl »

That sounds very similar to what I did for my plant game, except it operates on a 0-1 scale for x and y.
Earliest Love2D supporter who can't Love anymore. Let me disable pixel shaders if I don't use them, dammit!
Lenovo Thinkpad X60 Tablet, built like a tank. But not fancy enough for Love2D 0.10.0+.
Post Reply

Who is online

Users browsing this forum: No registered users and 3 guests