Is there a way to change font color?

General discussion about LÖVE, Lua, game development, puns, and unicorns.
Post Reply
zine92
Prole
Posts: 6
Joined: Wed Mar 17, 2010 4:33 am

Is there a way to change font color?

Post by zine92 »

i wanted to change the color of the font displayed. Because i loaded a white background image and i decided to trace the mouseX and mouseY, but since text is is white, i cannot see properly. So is there anyway to change the font color. thanks.
User avatar
bartbes
Sex machine
Posts: 4946
Joined: Fri Aug 29, 2008 10:35 am
Location: The Netherlands
Contact:

Re: Is there a way to change font color?

Post by bartbes »

Everything is drawn using the foreground color, so use love.graphics.setColor.
zine92
Prole
Posts: 6
Joined: Wed Mar 17, 2010 4:33 am

Re: Is there a way to change font color?

Post by zine92 »

i try using set color and this make my whole game screen black which covers the image. This is what i typed

Code: Select all

mouseX = love.mouse.getX()
		mouseY = love.mouse.getY()
		love.graphics.setColor(0,0,0,255)
		love.graphics.draw(menu,0,0)
		love.graphics.setFont(50) 
		love.graphics.print("X: "..mouseX, 100, 100)
		love.graphics.print("Y: "..mouseY, 400, 100)
and

Code: Select all

mouseX = love.mouse.getX()
		mouseY = love.mouse.getY()
		love.graphics.setColor(255,255,255,255)
		love.graphics.draw(menu,0,0)
		love.graphics.setFont(50) 
		love.graphics.print("X: "..mouseX, 100, 100)
		love.graphics.print("Y: "..mouseY, 400, 100)
Attachments
Screenshot-2.png
Screenshot-2.png (291.12 KiB) Viewed 10259 times
Screenshot-1.png
Screenshot-1.png (323.03 KiB) Viewed 10259 times
User avatar
bartbes
Sex machine
Posts: 4946
Joined: Fri Aug 29, 2008 10:35 am
Location: The Netherlands
Contact:

Re: Is there a way to change font color?

Post by bartbes »

setColor colors the images as well, oh and stop using setFont(<size>) in love.draw, it creates a font every single frame.
zine92
Prole
Posts: 6
Joined: Wed Mar 17, 2010 4:33 am

Re: Is there a way to change font color?

Post by zine92 »

okay. thanks.
User avatar
nevon
Commander of the Circuloids
Posts: 938
Joined: Thu Feb 14, 2008 8:25 pm
Location: Stockholm, Sweden
Contact:

Re: Is there a way to change font color?

Post by nevon »

bartbes wrote:setColor colors the images as well
Unless you change colormode from modulate to replace.
Post Reply

Who is online

Users browsing this forum: slime and 7 guests