When I set the colour of text, it changes the colour like it should. However, I can set the colour for my image, because it uses multiple colours (as most images do). How do I make it so when I use a image, it stay the colour it is, and is not affected by the current colour?
love.graphics.setColorMode("replace") -- images will not be affected by current color
function love.draw()
love.graphics.setColorMode("modulate") -- image WIILL be affected
love.graphics.setColor(0,255,0)
love.graphics.print("hello, i'm Green!", 10,10)
love.graphics.setColorMode("replace") --not sure if that is needed
love.graphics.print("not Green, yeaaah!", 30 , 30)
end
edit (or without push pop code should work)
Last edited by Larsii30 on Sun Apr 29, 2012 9:22 pm, edited 5 times in total.
function Lib.draw() -- Draws all the objects.
for k, obj in pairs(Objects) do
if obj.objtype == "Label" then
love.graphics.setColor(obj.red, obj.green, obj.blue)
love.graphics.setFont(love.graphics.newFont(obj.fontsize))
love.graphics.print(obj.words, obj.xpos, obj.ypos)
elseif obj.objtype == "Button" then
love.graphics.setColor(obj.red, obj.green, obj.blue)
love.graphics.rectangle(obj.status, obj.xpos, obj.ypos, obj.height, obj.width)
elseif obj.objtype == "Image" then
love.graphics.draw(obj.pic, obj.x, obj.y)
end
end
end
Say a button is drawn before a image. The colour is set to the colour of the button. Then when you draw a image, it uses that colour. That's what I'm trying to avoid.