resolution_solution
resolution_solution copied to clipboard
Yet another scaling library. Currently in maintenance-only mode.
Resolution Solution
Yet another scaling library. Currently in maintenance-only mode.
Resolution Solution was inspired by:
Other similar scaling libraries:
Video demonstration
Basic setup
- Require library:
local rs = require("resolution_solution")
- Configure library:
rs.conf({game_width = 640, game_height = 480, scale_mode = 3})
- 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()
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
Manual, examples, demo
- .pdf manual.
- .odt manual.
- .love demo example that you can run.
- examples folder.
Selling points of this library
-
Library have 3 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.
-
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.
-
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. -
Library has .pdf manual, that includes some illustrations, examples, explanations, tips and tricks.
-
Written with
snake_case
. -
Library licensed under
The Unlicense
. Do whatever you want with it.
Games made using this library
By togfoxy:
By Gunroar:
Announces
I will post announces when new update will be dropped here.
Contacts
If you have any questions about this library, have ideas, etc, you can contact me via:
- Submit new issue.
- love forum.
- matrix.
- Email - [email protected]