Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Feb 20, 2011, 12:47:57 AM (13 years ago)
Author:
landauf
Message:

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

File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/branches/usability/data/gui/scripts/CreditsMenu.lua

    r7732 r7922  
    33local P = createMenuSheet("CreditsMenu")
    44
    5 P.buttonList = {}
    65P.scrollbarWidth = 13
    76
    87function P.onLoad()
    9     local item = {
     8    P:initButtons(1, 1)
     9    P:setButton(1, 1, {
    1010            ["button"] = winMgr:getWindow("orxonox/CreditsBackButton"),
    11             ["function"]  = P.CreditsBackButton_clicked
    12     }
    13     P.buttonList[1] = item
     11            ["callback"]  = P.CreditsBackButton_clicked
     12    })
    1413end
    1514
    1615function P.onShow()
    17     --indices to iterate through buttonlist
    18     P.oldindex = -2
    19     P.index = -1
    20 
    2116    local description = winMgr:getWindow("orxonox/CreditsText")
    2217    description:setProperty("HorzFormatting", "WordWrapLeftAligned")
     
    3328end
    3429
    35 function P.onKeyPressed()
    36     buttonIteratorHelper(P.buttonList, code, P, 1, 1)
    37 end
    38 
    3930return P
    4031
Note: See TracChangeset for help on using the changeset viewer.