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

    r7801 r7922  
    33local P = createMenuSheet("GraphicsMenu")
    44
    5 P.buttonList = {}
    65P.schemeList = {"TaharezGreen", "Orxonox"}
    7 
    8 function P.onShow()
    9     --indices to iterate through buttonlist (trivial in this menu sheet)
    10     P.oldindex = -2
    11     P.index = -1
    12 end
    136
    147function P.onLoad()
     
    9386    block = false
    9487
    95     local item = {
     88    P:initButtons(1, 1)
     89    P:setButton(1, 1, {
    9690            ["button"] = winMgr:getWindow("orxonox/GraphicsBackButton"),
    97             ["function"]  = P.GraphicsBackButton_clicked
    98     }
    99     P.buttonList[1] = item
     91            ["callback"]  = P.GraphicsBackButton_clicked
     92    })
    10093
    10194    local dropbox = winMgr:getWindow("orxonox/ThemeDropBox")
     
    233226end
    234227
    235 function P.onKeyPressed()
    236     buttonIteratorHelper(P.buttonList, code, P, 1, 1)
    237 end
    238 
    239228return P
    240229
Note: See TracChangeset for help on using the changeset viewer.