Add a simple menu scene #93

Open
opened 2024-11-05 17:06:08 +01:00 by kazhnuz · 2 comments
Owner

-> Include a single menu
-> Add a position and dimension for onScreen positionning that'll be passed to the menu to draw it at the right position
-> Add a way to take the menu from a lua module (by default load the default ones)
-> Add a callback for drawing the widgets and calling the actions, handled directly by the scene
-> Add a way to construct the menu from a function and/or from a direct list

-> Include a single menu -> Add a position and dimension for onScreen positionning that'll be passed to the menu to draw it at the right position -> Add a way to take the menu from a lua module (by default load the default ones) -> Add a callback for drawing the widgets and calling the actions, handled directly by the scene -> Add a way to construct the menu from a function and/or from a direct list
kazhnuz added this to the epervier 0.7.0 milestone 2024-11-05 17:06:08 +01:00
kazhnuz added the
1. Feature
4. Scenes
labels 2024-11-05 17:06:08 +01:00
Author
Owner
local Menu = menu {
  type = "list",
  name = "Option Menu"
  position = {x = 0, y = 0},
  dimensions = {w = 80, h = 80},
  _noBack = true, -- false by default, can be put on submenu directly
  _noIndex = false, --false by default, fail if there is a non-submenu on the "index" of the list
  _draw = "drawElement" -- "drawElement by default, fail on a multiMenu",
  _action = "todo" -- "can be put on a specific data"
  list = {
    { name = "New Game", scene="newgame" },
    { name = "", _isSubList = true, _function="funcName" },
    { name = "", _isSubList = true, list= {
      todo
    } },
  }
}

function Menu:action(data)

end

function Menu:drawElement(w, h)

end

function Menu:drawBackground()

  return false
end

```lua local Menu = menu { type = "list", name = "Option Menu" position = {x = 0, y = 0}, dimensions = {w = 80, h = 80}, _noBack = true, -- false by default, can be put on submenu directly _noIndex = false, --false by default, fail if there is a non-submenu on the "index" of the list _draw = "drawElement" -- "drawElement by default, fail on a multiMenu", _action = "todo" -- "can be put on a specific data" list = { { name = "New Game", scene="newgame" }, { name = "", _isSubList = true, _function="funcName" }, { name = "", _isSubList = true, list= { todo } }, } } function Menu:action(data) end function Menu:drawElement(w, h) end function Menu:drawBackground() return false end ```
Author
Owner

La generation du contenu se fait en itérant sur list (_function et _fromData sera plus tard). Si isSubList, en plus d'ajouter l'élément on rajoute une nouvelle page avec le même nom, et avec _noBack en argument.

Si y'a pas de name, fail automatique.

La generation du contenu se fait en itérant sur list (_function et _fromData sera plus tard). Si isSubList, en plus d'ajouter l'élément on rajoute une nouvelle page avec le même nom, et avec _noBack en argument. Si y'a pas de `name`, fail automatique.
Sign in to join this conversation.
No description provided.