I don't know how to make the font scalable.
This is how I did it for my game, but the font dimension is 200 whether you're playing on a 128x128px screen or a 1920x1080px screen.
Code: Select all
self.font = lg.newFont("assets/font/bpreplay-bold.otf", 200)
self.tap = la.newSource("assets/sounds/menu/tap.ogg", "static")
self.text = lg.newText(self.font, "Aarstider")
lg.setFont(self.font)
lg.print("Aarstider", self.gameTitleX, self.gameTitleY)
Code: Select all
self.exitImg = lg.newImage("assets/images/menu/imagebuttons/quit.png")
self.exitImgW = wWidth / 15
self.exitImgH = wHeight / 10
self.exitImgSx = self.exitImgW / self.exitImg:getWidth()
self.exitImgSy = self.exitImgH / self.exitImg:getHeight()
self.exitImgX = wWidth - wWidth / 13
self.exitImgY = wHeight / 50
lg.draw(self.exitImg, self.exitImgX, self.exitImgY, 0, self.exitImgSx, self.exitImgSy)
I could pass a value based on your resolution instead of passing 200 as the font size, but isn't there a better way like I do for my objects?