Mothback/code/ui.lua

35 lines
768 B
Lua

UIElement = {}
function addElement(self)
table.insert(UIElement,self)
self.id = #UIElement
end
function drawTextBox(text,x,y,color,background_color)
local c1, c2, c3, a = love.graphics.getColor()
local width = locale_font:getWidth(text)
local height = locale_font:getHeight(text)
local margin = 5
love.graphics.setColor(unpack(color))
love.graphics.rectangle("fill",
x-1,
y-1,
width+margin*2+2,
height+margin*2+2
)
love.graphics.setColor(unpack(background_color))
love.graphics.rectangle("fill",
x,
y,
width+margin*2,
height+margin*2
)
love.graphics.setColor(unpack(color))
love.graphics.print(text, x+margin, y+margin)
love.graphics.setColor(c1,c2,c3,a)
end
require "code/ui/button"
require "code/ui/dialog"
require "code/ui/prompt"