Page 1 of 1

font sizes

Posted: Tue Jul 07, 2015 2:38 pm
by CanadianGamer
Hi,

I am making a game however I have run into a problem I am trying to set multiple font sizes but it is not working here is the code

Code: Select all

font1 = love.graphics.newFont('assets/font1.ttf', 150)
font2 = love.graphics.newFont('assets/font2.ttf', 50)


function love.load()
	backgroundImg = love.graphics.newImage('assets/background.png')
	title = true
end

function love.update()

end

function love.draw()
	love.graphics.draw(backgroundImg, 0, 0)
	if title == true then
		love.graphics.setFont(font1)
		love.graphics.print('Dodge', 100, 20)
		love.graphics.setFont(font2)
		love.graphics.print('Play', 100, 300)
		
	end
end

Re: font sizes

Posted: Tue Jul 07, 2015 2:54 pm
by arampl
Try to put first two strings inside love.load.

btw, you can simply write "if title then" instead of "if title == true then" (the same goes with false values: "if not title then" equals to "if title == false then")...

Re: font sizes

Posted: Tue Jul 07, 2015 2:58 pm
by CanadianGamer
Thanks for the help

Re: font sizes

Posted: Mon Jul 13, 2015 1:05 am
by fleshwhiskey
Also, another quick suggestion: Don't put setnewfont in any other function but love.load . It's very taxing on your computer and will cause your game to crash. I learned that the hard way... >_<'

Re: font sizes

Posted: Mon Jul 13, 2015 1:07 am
by FruityLark
fleshwhiskey wrote:Also, another quick suggestion: Don't put setnewfont in any other function but love.load . It's very taxing on your computer and will cause your game to crash. I learned that the hard way... >_<'
Do you mean setFont() or newFont() ?

Re: font sizes

Posted: Mon Jul 13, 2015 4:06 am
by zorg
FruityLark wrote:
fleshwhiskey wrote:Also, another quick suggestion: Don't put setnewfont in any other function but love.load . It's very taxing on your computer and will cause your game to crash. I learned that the hard way... >_<'
Do you mean setFont() or newFont() ?
he means newFont

Re: font sizes

Posted: Mon Jul 13, 2015 5:50 am
by fleshwhiskey
zorg wrote:
FruityLark wrote:
fleshwhiskey wrote:Also, another quick suggestion: Don't put setnewfont in any other function but love.load . It's very taxing on your computer and will cause your game to crash. I learned that the hard way... >_<'
Do you mean setFont() or newFont() ?
he means newFont
Yeah, i mixed newFont up with https://love2d.org/wiki/love.graphics.setNewFont .. oops