| 
                Last change
                  on this file since 10179 was
                  7928,
                  checked in by landauf, 15 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
           | 
      
      
        
  | Line |   | 
|---|
| 1 | -- ControlsMenu.lua | 
|---|
| 2 |  | 
|---|
| 3 | local P = createMenuSheet("ControlsMenu") | 
|---|
| 4 | P.loadAlong = { "MouseControlsMenu", "KeyBindMenu" } | 
|---|
| 5 |  | 
|---|
| 6 | function P.onLoad() | 
|---|
| 7 |     P.multiplayerMode = "startClient" | 
|---|
| 8 |  | 
|---|
| 9 |     --buttons are arranged in a 3x1 matrix: | 
|---|
| 10 |     P:setButton(1, 1, { | 
|---|
| 11 |             ["button"] = winMgr:getWindow("orxonox/MouseControlsButton"), | 
|---|
| 12 |             ["callback"]  = P.ControlsMouseControlsButton_clicked | 
|---|
| 13 |     }) | 
|---|
| 14 |  | 
|---|
| 15 |     P:setButton(2, 1, { | 
|---|
| 16 |             ["button"] = winMgr:getWindow("orxonox/KeybindingsButton"), | 
|---|
| 17 |             ["callback"]  = P.ControlsKeyboardControlsButton_clicked | 
|---|
| 18 |     }) | 
|---|
| 19 |  | 
|---|
| 20 |     P:setButton(3, 1, { | 
|---|
| 21 |             ["button"] = winMgr:getWindow("orxonox/ControlsBackButton"), | 
|---|
| 22 |             ["callback"]  = P.ControlsBackButton_clicked | 
|---|
| 23 |     }) | 
|---|
| 24 | end | 
|---|
| 25 |  | 
|---|
| 26 | function P.ControlsMouseControlsButton_clicked(e) | 
|---|
| 27 |     showMenuSheet("MouseControlsMenu", true) | 
|---|
| 28 | end | 
|---|
| 29 |  | 
|---|
| 30 | function P.ControlsKeyboardControlsButton_clicked(e) | 
|---|
| 31 |     showMenuSheet("KeyBindMenu", true) | 
|---|
| 32 | end | 
|---|
| 33 |  | 
|---|
| 34 | function P.ControlsBackButton_clicked(e) | 
|---|
| 35 |     hideMenuSheet(P.name) | 
|---|
| 36 | end | 
|---|
| 37 |  | 
|---|
| 38 | return P | 
|---|
| 39 |  | 
|---|
       
      
      Note: See 
TracBrowser
        for help on using the repository browser.