stateMainMenu = {}

local backy
local menuID = 0 -- on met un fallback à 0 au cas-où

function stateMainMenu:enter(previous)
  assets:setBackground("back")
  menus:reset()
  mainmenu = GridBox(48, 48, 480-(48+48), 274-(48+32), 4, 4)
  menus:addMenu(mainmenu)
  mainmenu:addWidget(DummyWidget())
  mainmenu:addWidget(DummyWidget())
  mainmenu:addWidget(DummyWidget())
  mainmenu:addWidget(DummyWidget())

  mainmenu:addWidget(DummyWidget())
  mainmenu:addWidget(DummyWidget())
  mainmenu:addWidget(DummyWidget())
  mainmenu:addWidget(DummyWidget())

  mainmenu:addWidget(DummyWidget())
  mainmenu:addWidget(DummyWidget())
  mainmenu:addWidget(DummyWidget())

  mainmenu.focus = true
  mainmenu:addCol(1)
  mainmenu:addLine(1)
  mainmenu:addCol(3)
  mainmenu:addCol(7)
  mainmenu:addLine(9)
  mainmenu:addLine(10)

  --mainmenu:expandHorizontal(1)
  --mainmenu:expandCol(1)
  --mainmenu:expandCol(2)
end

function stateMainMenu:update()
  menus:update()
end

function stateMainMenu:keyreleased(key, code)
  menus:keyreleased(key, code)
end

function stateMainMenu:mousemoved(x, y, dx, dy)
  menus:mousemoved(x, y, dx, dy)
end

function stateMainMenu:mousepressed( x, y, button, istouch )
  menus:mousepressed( x, y, button, istouch )
end

function stateMainMenu:draw(dt)
  assets:drawBackground()

  menus:draw()
end
