feat(textElem): add opacity handling
This commit is contained in:
parent
959fd99ba4
commit
07400ce991
1 changed files with 3 additions and 0 deletions
|
@ -7,6 +7,7 @@ function TextElement:new(name, fontName, text, x, y, align)
|
||||||
self.font = self.assets.fonts[fontName]
|
self.font = self.assets.fonts[fontName]
|
||||||
|
|
||||||
self.align = align
|
self.align = align
|
||||||
|
self.opacity = 1
|
||||||
end
|
end
|
||||||
|
|
||||||
function TextElement:getText()
|
function TextElement:getText()
|
||||||
|
@ -14,7 +15,9 @@ function TextElement:getText()
|
||||||
end
|
end
|
||||||
|
|
||||||
function TextElement:draw()
|
function TextElement:draw()
|
||||||
|
self.font:setColor(1, 1, 1, self.opacity)
|
||||||
self.font:draw(self:getText(), self.x, self.y, -1, self.align)
|
self.font:draw(self:getText(), self.x, self.y, -1, self.align)
|
||||||
|
love.graphics.setColor(1, 1, 1, 1)
|
||||||
end
|
end
|
||||||
|
|
||||||
return TextElement
|
return TextElement
|
Loading…
Reference in a new issue