local graphics = require("graphics") Text = {x = 1, y = 1, title="New Text", bColor=0xaaaaaa, fColor=0x000000, isCentered= false} Text.__index = Text function Text:new(x,y,title,isCentered,bColor,fColor) local self = {} setmetatable(self, Text) self.x = math.floor(x) self.y = math.floor(y) self.title = title self.bColor = bColor self.fColor = fColor self.visible = true self.isCentered = isCentered return self end function Text:draw() if not self.visible then return end local gpu = graphics.gpu gpu.setBackground(self.bColor) gpu.setForeground(self.fColor) if self.isCentered then gpu.set(graphics.w / 2 - #self.title / 2, self.y, self.title) else gpu.set(self.x, self.y, self.title) end end return Text