simpleScale
simpleScale copied to clipboard
A simple library for scaling games made in love2d to any screen size.
simpleScale
A simple library for scaling games made in LÖVE to any window size and aspect ratio.
![]()
Scales the game while maintaining its aspect ratio, adding vertical or horizontal letterboxes if necessary. Inspired by TLfres and used in SuperLuminauts.
TO USE:
-
Import simpleScale
-
In love.load call
simpleScale.setWindow(gameWidth, gameHeight, windowWidth, windowHeight, flags)gameWidth- width of the gamegameHeight- height of the gamewindowWidth- width of the final windowwindowHeight- height of the final windowflags- a table of optional flags corresponding to those used in love.window.setmode https://love2d.org/wiki/love.window.setMode -
At the start of love.draw call
simpleScale.set() -
At the end of love.draw call
simpleScale.unSet()
Additional Features:
-
To update the window again, just call
simpleScale.updateWindow(windowWidth, windowHeight, flags) -
To change the color of the letterboxes, simply call
simpleScale.unSet({r, g, b}). Alpha values are optionally accepted as well. -
If your window needs to be resizable by dragging, just call
simpleScale.resizeUpdate()in love.update