Skip to main content

Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
TagsGame Engines

how do you use love.graphics.scale ? any example?

(2 edits)
local GameWidth,GameHeight=1728,1080 -- res of your base code
love.window.setFullscreen(true) -- set fullscreen for client

local ScreenWidth,ScreenHeight= love.window.getDesktopDimensions() -- get res of client
love.window.setMode(ScreenWidth, ScreenHeight, {resizable=false, vsync=false, minwidth=400, minheight=300}) -- apply res client with setting if you need...

ScreenScaleY=ScreenHeight/GameHeight  -- calcul scale Y
ScreenScaleX=ScreenWidth/GameWidth  -- calcul scale X

ScreenScale=math.min(ScreenScaleX,ScreenScaleY) -- get lower scale of x or Y
love.graphics.Scale(ScreenScale,ScreenScale) -- apply this in your love.draw

and you can center screen witch love.graphics.translate(dx,dy) or draw your game in canvas…

Deleted 2 years ago