You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Keeps the game screen size and aspect ratio constant when resizing window.
Makes it easier to work with a fixed resolution.
how to use:
-- How to include the lib into the projectlocallovesize=require("lovesize/lovesize")
-- Pass desired resolution (can be called again to change it)functionlove.load()
lovesize.set(800, 600)
-- Enable screen resizing (optional)localflags= {}
flags.resizable=truelove.window.setMode(lovesize.getWidth(), lovesize.getHeight(), flags)
end-- Necessary to keep the correct values up to datefunctionlove.resize(width, height)
lovesize.resize(width, height)
end-- How to draw stuff functionlove.draw()
-- Example how to clear the letterboxes with a white colorlove.graphics.clear(255,255,255)
lovesize.begin()
-- Draw your game stuff herelovesize.finish()
-- Draw stuff using screen coords hereend-- Example how to use "inside" and "pos" functions:functionlove.mousepressed(x, y, button, istouch)
localcircle= {}
iflovesize.inside(x, y) thencircle.x, circle.y=lovesize.pos(x, y)
table.insert(circles, circle)
endend
Example:
800x600 resolution within vertical window:
800x600 resolution within horizontal window:
About
Keeps the screen aspect ratio constant when resizing window.