font sizes

Questions about the LÖVE API, installing LÖVE and other support related questions go here.
Forum rules
Before you make a thread asking for help, read this.
Post Reply
User avatar
CanadianGamer
Party member
Posts: 132
Joined: Tue Jun 30, 2015 1:23 pm
Location: Canada
Contact:

font sizes

Post 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
My serious itch.io page:
https://pentamonium-studios.itch.io/
My less serious itch.io page:
http://canadiangamer.itch.io
User avatar
arampl
Party member
Posts: 248
Joined: Mon Oct 20, 2014 3:26 pm

Re: font sizes

Post 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")...
Last edited by arampl on Tue Jul 07, 2015 2:59 pm, edited 1 time in total.
User avatar
CanadianGamer
Party member
Posts: 132
Joined: Tue Jun 30, 2015 1:23 pm
Location: Canada
Contact:

Re: font sizes

Post by CanadianGamer »

Thanks for the help
My serious itch.io page:
https://pentamonium-studios.itch.io/
My less serious itch.io page:
http://canadiangamer.itch.io
fleshwhiskey
Prole
Posts: 35
Joined: Mon Nov 24, 2014 6:20 am

Re: font sizes

Post 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... >_<'
hello!
User avatar
FruityLark
Prole
Posts: 28
Joined: Sat Jun 13, 2015 8:18 pm

Re: font sizes

Post 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() ?
User avatar
zorg
Party member
Posts: 3441
Joined: Thu Dec 13, 2012 2:55 pm
Location: Absurdistan, Hungary
Contact:

Re: font sizes

Post 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
Me and my stuff :3True Neutral Aspirant. Why, yes, i do indeed enjoy sarcastically correcting others when they make the most blatant of spelling mistakes. No bullying or trolling the innocent tho.
fleshwhiskey
Prole
Posts: 35
Joined: Mon Nov 24, 2014 6:20 am

Re: font sizes

Post 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
hello!
Post Reply

Who is online

Users browsing this forum: No registered users and 16 guests