Yet another scaling library. Currently in maintenance-only mode.
Resolution Solution was inspired by:
Other similar scaling libraries that you might want to look into:
- Require library:
local rs = require("resolution_solution")
- Configure library:
rs.conf({game_width = 640, game_height = 480, scale_mode = rs.PIXEL_PERFECT_MODE})
- Make window resizable (optionally, but stongly advised):
rs.setMode(rs.game_width, rs.game_height, {resizable = true})
- Hook into
love.resize
:
love.resize = function(w, h)
rs.resize(w, h)
end
- Draw something:
(In this example we used scissors, but there another way to achieve this. Read manual or check examples for more info.)
love.draw = function()
rs.push()
local old_x, old_y, old_w, old_h = love.graphics.getScissor()
love.graphics.setScissor(rs.get_game_zone())
love.graphics.setColor(1, 1, 1)
love.graphics.print("Hello, world!", rs.game_width / 2, rs.game_height / 2)
love.graphics.setScissor(old_x, old_y, old_w, old_h)
rs.pop()
end
- .pdf manual.
- .odt manual.
- .love demo example that you can run.
- Demo folder that you can run with
cd demo; love .
- examples folder.
-
Library have 4 scale modes and you can switch between at any time:
- Aspect Scaling mode - scaling with preserved aspect.
- Stretching - stretch game to fill entire window.
- Pixel Perfect - will scale, using only integer scale factors and adds black bars if it can't. Must-have for pixel-art.
- No Scale - as name suggests, nothing will be scalled. Might be useful for debugging or if you make some kind of program (e.g, game engine) where you need to switch between scaling for game itself and no scaling when user editing game scripts.
-
Library doesn't force you to use any specific way to scale your content, unlike some libraries. You can choose canvas, scissors, draw rectangles on top of game, shader, etc. Pick whatever you like!
-
Library written with kikito's guide in mind, which resulted in very monkey-patchable library! No unreachable locals, no globals, nothing like that! Everything that library produces during calculations can be reached by simple accessing library table:
rs.game_width
,rs.scale_mode
,rs.game_zone.x
, etc. Hack and slash your way to make library suitable for your game! -
Library has .pdf manual, that includes some illustrations, examples, explanations, tips and tricks. Single file documentation, that can be opened in almost anything, including your browser!
-
Written with
snake_case
. Before it was camelCase. -
Library licensed under
The Unlicense
. Do whatever you want with it with no restrictions!
By togfoxy:
By Gunroar:
By Saxashitter:
If you made game/program using this library, fell free to ask via contacts to add your game in this list.
I will post announces when new update will be dropped here or will create new release here on GitHub.
If you have any questions about this library, have ideas, etc, you can contact me via:
- Submit new issue.
- love forum.
- matrix.
- Email - volkovissocool@gmail.com