Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/branches/usability/data/gui/scripts/CreditsMenu.lua @ 7922

Last change on this file since 7922 was 7922, checked in by landauf, 13 years ago

implemented new keyboard control of menu buttons with these new features:

  • more intuitive placement of buttons in table (row/column format instead of linear index)
  • no need to overwrite onShow() and onKeyPressed() functions, no need for P.buttonList
  • highlights the selected button in a different layout than mouse hovering
  • remembers the selection while moving through the menu hierarchy, but resets it if the menu is closed
  • allows preselected button (for example "Yes" in decision popup)
  • when opening a menu, the first selected button is not always the upper left, but instead depends on the pressed key (e.g. the 'up' key selects the button at the bottom, while the 'down' key selects the button at the top. once a button is selected, the keys behave as usual)

+ fixed wrong callback function in ingame menu

  • Property svn:eol-style set to native
File size: 1.1 KB
Line 
1-- CreditsMenu.lua
2
3local P = createMenuSheet("CreditsMenu")
4
5P.scrollbarWidth = 13
6
7function P.onLoad()
8    P:initButtons(1, 1)
9    P:setButton(1, 1, {
10            ["button"] = winMgr:getWindow("orxonox/CreditsBackButton"),
11            ["callback"]  = P.CreditsBackButton_clicked
12    })
13end
14
15function P.onShow()
16    local description = winMgr:getWindow("orxonox/CreditsText")
17    description:setProperty("HorzFormatting", "WordWrapLeftAligned")
18    description:setProperty("VertFormatting", "TopAligned")
19    description:setText("                                   Orxonox version 0.0.3 \n\n       Programming Language:  C++ - lua - tcl \n       Environment:  OpenAL - Ogre - OIS - CEGUI - enet - ODE \n       Licence:  GNU General Public Licence - Creative Commons \n       http://www.orxonox.net \n \n       Credits:")
20
21    description:setSize(CEGUI.UVector2(CEGUI.UDim(1.0, -P.scrollbarWidth), CEGUI.UDim(1.0, 0)))
22    height = getStaticTextWindowHeight(description)
23    description:setHeight(CEGUI.UDim(0, height))
24end
25
26function P.CreditsBackButton_clicked(e)
27    hideMenuSheet(P.name)
28end
29
30return P
31
Note: See TracBrowser for help on using the repository browser.