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/AudioMenu.lua

    r7689 r7922  
    22
    33local P = createMenuSheet("AudioMenu")
    4 
    5 P.buttonList = {}
    6 
    7 function P.onShow()
    8     P.oldindex = -2
    9     P.index = -1
    10 end
    114
    125function P.onLoad()
     
    5043    end
    5144
    52     local item = {
     45    P:initButtons(1, 1)
     46    P:setButton(1, 1, {
    5347            ["button"] = winMgr:getWindow("orxonox/AudioBackButton"),
    54             ["function"]  = P.AudioBackButton_clicked
    55     }
    56     P.buttonList[1] = item
     48            ["callback"]  = P.AudioBackButton_clicked
     49    })
    5750end
    5851
     
    185178end
    186179
    187 function P.onKeyPressed()
    188     buttonIteratorHelper(P.buttonList, code, P, 1, 1)
    189 end
    190 
    191180return P
    192181
Note: See TracChangeset for help on using the changeset viewer.