Skip to content

Instantly share code, notes, and snippets.

@eka

eka/menu.lua Secret

Last active August 29, 2015 14:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save eka/8012b136e3295add2efd to your computer and use it in GitHub Desktop.
Save eka/8012b136e3295add2efd to your computer and use it in GitHub Desktop.
local gui = require "lib.quickie"
local playState = require "lib.states.play"
local menu = {}
function menu:enter()
end
function menu:init()
self.btnWidth = 100
self.btnHeight = 32
self.btnQty = 3
end
function menu:update(dt)
local width = love.window.getWidth()
local height = love.window.getHeight()
gui.group.push({grow='down', pos={(width/2) - self.btnWidth/2, (height/2) - (self.btnHeight*self.btnQty)/2}})
if gui.Button({id='play', text='Play'}) then
Gamestate.switch(playState)
end
if gui.Button({id='credits', text='Credits'}) then
print('Button about clicked')
end
if gui.Button({id='help', text='Help'}) then
end
end
function menu:draw()
gui.core.draw()
end
function menu:keyreleased(key, code)
end
function menu:keypressed(key, code)
end
return menu
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment