Renamed ButtonGroup to VBox.
This commit is contained in:
@@ -12,14 +12,14 @@ local TextButton = require 'src.ui.textbtn'
|
||||
-- Class definitions
|
||||
------------------------------------------------------------------------------
|
||||
|
||||
local ButtonGroup = make_class(Drawable, Asset)
|
||||
local VBox = make_class(Drawable, Asset)
|
||||
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
-- Class methods
|
||||
------------------------------------------------------------------------------
|
||||
|
||||
function ButtonGroup:_init(x, y, spacing)
|
||||
function VBox:_init(x, y, spacing)
|
||||
self.x = x ~= nil and x or 0
|
||||
self.y = y ~= nil and y or 0
|
||||
self.s = spacing ~= nil and spacing or 10
|
||||
@@ -27,12 +27,12 @@ function ButtonGroup:_init(x, y, spacing)
|
||||
end
|
||||
|
||||
|
||||
function ButtonGroup:add_text_button(text, font, callback, base_col, sel_color, press_col)
|
||||
function VBox:add_text_button(text, font, callback, base_col, sel_color, press_col)
|
||||
table.insert(self.btns, TextButton(text, font, 0, 0, callback, base_col, sel_color, press_col))
|
||||
end
|
||||
|
||||
|
||||
function ButtonGroup:load()
|
||||
function VBox:load()
|
||||
local y = self.y
|
||||
|
||||
-- Load required assets if needed and then compute the coordinates of each button.
|
||||
@@ -49,7 +49,7 @@ function ButtonGroup:load()
|
||||
end
|
||||
|
||||
|
||||
function ButtonGroup:unload()
|
||||
function VBox:unload()
|
||||
for _, v in pairs(self.btns) do
|
||||
if v.is_a[Asset] then
|
||||
v:unload()
|
||||
@@ -58,35 +58,35 @@ function ButtonGroup:unload()
|
||||
end
|
||||
|
||||
|
||||
function ButtonGroup:update(dt)
|
||||
function VBox:update(dt)
|
||||
for _, v in pairs(self.btns) do
|
||||
v:update(dt)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
function ButtonGroup:draw()
|
||||
function VBox:draw()
|
||||
for _, v in pairs(self.btns) do
|
||||
v:draw()
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
function ButtonGroup:mousemoved(x, y, dx, dy)
|
||||
function VBox:mousemoved(x, y, dx, dy)
|
||||
for _, v in pairs(self.btns) do
|
||||
v:mousemoved(x, y, dx, dy)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
function ButtonGroup:mousepressed(x, y, btn)
|
||||
function VBox:mousepressed(x, y, btn)
|
||||
for _, v in pairs(self.btns) do
|
||||
v:mousepressed(x, y, btn)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
function ButtonGroup:mousereleased(x, y, btn)
|
||||
function VBox:mousereleased(x, y, btn)
|
||||
for _, v in pairs(self.btns) do
|
||||
v:mousereleased(x, y, btn)
|
||||
end
|
||||
@@ -97,4 +97,4 @@ end
|
||||
-- Module return
|
||||
------------------------------------------------------------------------------
|
||||
|
||||
return ButtonGroup
|
||||
return VBox
|
||||
Reference in New Issue
Block a user