22 lines
544 B
Lua
22 lines
544 B
Lua
|
local Parent = require "birb.modules.gui.elements.parent"
|
||
|
local TextElement = Parent:extend()
|
||
|
|
||
|
function TextElement:new(name, fontName, text, x, y, align, depth)
|
||
|
self.text = text
|
||
|
local gui = self:getGui()
|
||
|
self.font = gui.scene.assets.fonts[fontName]
|
||
|
|
||
|
TextElement.super.new(self, name, x, y, 1, 1)
|
||
|
self.align = align
|
||
|
self.depth = depth or 0
|
||
|
end
|
||
|
|
||
|
function TextElement:getText()
|
||
|
return self.text
|
||
|
end
|
||
|
|
||
|
function TextElement:draw()
|
||
|
self.font:draw(self:getText(), self.x, self.y, -1, self.align)
|
||
|
end
|
||
|
|
||
|
return TextElement
|