sonic-radiance/sonic-radiance.love/birb/modules/gui/elements/text.lua

20 lines
474 B
Lua
Raw Normal View History

2021-08-22 16:45:43 +02:00
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)
2021-08-22 16:45:43 +02:00
self.text = text
self.font = self.assets.fonts[fontName]
2021-08-22 16:45:43 +02:00
self.align = align
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