Mouse hover/click
This commit is contained in:
+12
-7
@@ -1,13 +1,18 @@
|
||||
function stateMenu()
|
||||
|
||||
local items = {"play", "rules"}
|
||||
local buttons = {}
|
||||
local selected = 1
|
||||
local buttons = {
|
||||
makeButton(10, 10, 30, 6, "play",
|
||||
function() setState(states.game) end,
|
||||
function() selected = 1 end),
|
||||
makeButton(10, 20, 30, 6, "rules",
|
||||
function() setState(states.rules) end,
|
||||
function() selected = 2 end)
|
||||
}
|
||||
|
||||
function _enter()
|
||||
for k,v in ipairs(items) do
|
||||
local button = makeButton(10, k*10, 30, 6, v, function() printh("click") end)
|
||||
add(buttons, button)
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
return {
|
||||
@@ -19,8 +24,8 @@ function stateMenu()
|
||||
end,
|
||||
|
||||
_draw = function()
|
||||
for button in all(buttons) do
|
||||
button:draw()
|
||||
for k,button in ipairs(buttons) do
|
||||
button:draw(selected == k)
|
||||
end
|
||||
end
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user