Page 1 of 1

Is there a way to change font color?

Posted: Fri Mar 19, 2010 2:40 pm
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.

Re: Is there a way to change font color?

Posted: Fri Mar 19, 2010 2:42 pm
by bartbes
Everything is drawn using the foreground color, so use love.graphics.setColor.

Re: Is there a way to change font color?

Posted: Fri Mar 19, 2010 2:52 pm
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)

Re: Is there a way to change font color?

Posted: Fri Mar 19, 2010 2:59 pm
by bartbes
setColor colors the images as well, oh and stop using setFont(<size>) in love.draw, it creates a font every single frame.

Re: Is there a way to change font color?

Posted: Fri Mar 19, 2010 3:02 pm
by zine92
okay. thanks.

Re: Is there a way to change font color?

Posted: Fri Mar 19, 2010 4:11 pm
by nevon
bartbes wrote:setColor colors the images as well
Unless you change colormode from modulate to replace.