Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/branches/usability/data/gui/scripts/ControlsMenu.lua @ 10795

Last change on this file since 10795 was 7928, checked in by landauf, 14 years ago

more improvements for keyboard control of menus:

  • added setSelectionNear(r, c) function which tries to select the button closest to the given row/column
  • no initialization required anymore, the button-table grows dynamically if new buttons are inserted
  • Property svn:eol-style set to native
File size: 1010 bytes
RevLine 
[6363]1-- ControlsMenu.lua
2
[6746]3local P = createMenuSheet("ControlsMenu")
[6748]4P.loadAlong = { "MouseControlsMenu", "KeyBindMenu" }
[6363]5
[7689]6function P.onLoad()
[7922]7    P.multiplayerMode = "startClient"
[7689]8
9    --buttons are arranged in a 3x1 matrix:
[7922]10    P:setButton(1, 1, {
[7689]11            ["button"] = winMgr:getWindow("orxonox/MouseControlsButton"),
[7922]12            ["callback"]  = P.ControlsMouseControlsButton_clicked
13    })
[7689]14
[7922]15    P:setButton(2, 1, {
[7689]16            ["button"] = winMgr:getWindow("orxonox/KeybindingsButton"),
[7922]17            ["callback"]  = P.ControlsKeyboardControlsButton_clicked
18    })
[7689]19
[7922]20    P:setButton(3, 1, {
[7689]21            ["button"] = winMgr:getWindow("orxonox/ControlsBackButton"),
[7922]22            ["callback"]  = P.ControlsBackButton_clicked
23    })
[7689]24end
25
[6363]26function P.ControlsMouseControlsButton_clicked(e)
[6746]27    showMenuSheet("MouseControlsMenu", true)
[6363]28end
29
30function P.ControlsKeyboardControlsButton_clicked(e)
[6746]31    showMenuSheet("KeyBindMenu", true)
[6363]32end
33
34function P.ControlsBackButton_clicked(e)
[6746]35    hideMenuSheet(P.name)
[6363]36end
37
38return P
39
Note: See TracBrowser for help on using the repository browser.