sonic-bluestreak/sonic-bluestreak.love/birb/modules/gui/elements/text.lua
2021-11-25 10:46:15 +01:00

23 lines
No EOL
580 B
Lua

local Parent = require "birb.modules.gui.elements.parent"
local TextElement = Parent:extend()
function TextElement:new(name, fontName, text, x, y, align)
TextElement.super.new(self, name, x, y, 1, 1)
self.text = text
self.font = self.assets.fonts[fontName]
self.align = align
self.opacity = 1
end
function TextElement:getText()
return self.text
end
function TextElement:draw()
self.font:setColor(1, 1, 1, self.opacity)
self.font:draw(self:getText(), self.x, self.y, -1, self.align)
love.graphics.setColor(1, 1, 1, 1)
end
return TextElement