| 
                Last change
                  on this file since 6325 was
                  6048,
                  checked in by scheusso, 16 years ago
           | 
        
        
          | 
               
ESC handling in ingame menu: if theres already an opened GUI sheet then hide it, if not open the ingame menu 
in mainmenu everything should remain the same 
 
           | 
        
        | 
            File size:
            1014 bytes
           | 
      
      
        
  | Line |   | 
|---|
| 1 | -- InGameMenu.lua | 
|---|
| 2 |  | 
|---|
| 3 | BasicGUI = require("BasicGUI") | 
|---|
| 4 | local P = BasicGUI:new() --inherit everything from the gui package | 
|---|
| 5 | if _REQUIREDNAME == nil then | 
|---|
| 6 |     InGameMenu = P | 
|---|
| 7 | else | 
|---|
| 8 |     _G[_REQUIREDNAME] = P | 
|---|
| 9 | end | 
|---|
| 10 |  | 
|---|
| 11 | P.filename = "InGameMenu" | 
|---|
| 12 | P.layoutString = "InGameMenu.layout" | 
|---|
| 13 |  | 
|---|
| 14 | function P:init() | 
|---|
| 15 | end | 
|---|
| 16 |  | 
|---|
| 17 |  | 
|---|
| 18 | -- events for ingamemenu | 
|---|
| 19 | function P.button_quit_clicked(e) | 
|---|
| 20 |     openDecisionPopup( "Do you really want to quit the game?", InGameMenu.callback ) | 
|---|
| 21 | end | 
|---|
| 22 |  | 
|---|
| 23 | function P.button_mainmenu_clicked(e) | 
|---|
| 24 |     orxonox.Game:getInstance():popState() | 
|---|
| 25 |     orxonox.Game:getInstance():popState() | 
|---|
| 26 |     orxonox.Game:getInstance():requestState("mainmenu") | 
|---|
| 27 |     orxonox.CommandExecutor:execute("showGUI MainMenu") | 
|---|
| 28 |     orxonox.CommandExecutor:execute("hideGUI InGameMenu") | 
|---|
| 29 | end | 
|---|
| 30 |  | 
|---|
| 31 | function P.button_return_clicked(e) | 
|---|
| 32 |     orxonox.CommandExecutor:execute("hideGUI InGameMenu") | 
|---|
| 33 | end | 
|---|
| 34 |  | 
|---|
| 35 | function P.callback(doExit) | 
|---|
| 36 |     if doExit then | 
|---|
| 37 |         orxonox.CommandExecutor:execute("hideGUI InGameMenu") | 
|---|
| 38 |         orxonox.CommandExecutor:execute("exit") | 
|---|
| 39 |     end | 
|---|
| 40 | end | 
|---|
| 41 |  | 
|---|
| 42 | return P | 
|---|
| 43 |  | 
|---|
       
      
      Note: See 
TracBrowser
        for help on using the repository browser.