Added labels and flushed-right UI elements.
This commit is contained in:
@@ -19,13 +19,14 @@ local TextButton = make_class(Button)
|
||||
-- Class methods
|
||||
------------------------------------------------------------------------------
|
||||
|
||||
function TextButton:_init(text, font, x, y, callback, base_col, sel_color, press_col)
|
||||
Button._init(self, x, y, callback)
|
||||
function TextButton:_init(text, font, x, y, callback, float, base_col, sel_color, press_col)
|
||||
Button._init(self, x, y, callback, float)
|
||||
self.font = font
|
||||
self.text = text
|
||||
self.base_col = base_col ~= nil and base_col or Color(255, 255, 255)
|
||||
self.sel_color = sel_color ~= nil and sel_color or Color(215, 0, 0)
|
||||
self.press_col = press_col ~= nil and press_col or Color(99, 99, 139)
|
||||
self.disbl_col = Color(95, 63, 75)
|
||||
end
|
||||
|
||||
|
||||
@@ -56,7 +57,7 @@ end
|
||||
|
||||
|
||||
function TextButton:draw()
|
||||
local color = (self.pressed and self.press_col) or ((self.selected and self.sel_color) or self.base_col)
|
||||
local color = self.callback == nil and self.disbl_col or ((self.pressed and self.press_col) or ((self.selected and self.sel_color) or self.base_col))
|
||||
|
||||
love.graphics.setColor(color.r, color.g, color.b)
|
||||
self.font:set()
|
||||
|
||||
Reference in New Issue
Block a user