| 1 | -- MainMenu.lua | 
|---|
| 2 |  | 
|---|
| 3 | local P = createMenuSheet("MainMenu") | 
|---|
| 4 | P.loadAlong = { "SingleplayerMenu", "MultiplayerMenu", "SettingsMenu", "CreditsMenu" } | 
|---|
| 5 |  | 
|---|
| 6 | function P.onLoad() | 
|---|
| 7 | --buttons are arranged in a 6x1 Matrix (list) | 
|---|
| 8 | P:setButton(1, 1, { | 
|---|
| 9 | ["button"] = winMgr:getWindow("orxonox/QuickGameTestButton"), | 
|---|
| 10 | ["callback"]  = P.QuickGameTestButton_clicked | 
|---|
| 11 | }) | 
|---|
| 12 |  | 
|---|
| 13 | P:setButton(2, 1, { | 
|---|
| 14 | ["button"] = winMgr:getWindow("orxonox/SingleplayerButton"), | 
|---|
| 15 | ["callback"]  = P.SingleplayerButton_clicked | 
|---|
| 16 | }) | 
|---|
| 17 |  | 
|---|
| 18 | P:setButton(3, 1, { | 
|---|
| 19 | ["button"] = winMgr:getWindow("orxonox/MultiplayerButton"), | 
|---|
| 20 | ["callback"]  = P.MultiplayerButton_clicked | 
|---|
| 21 | }) | 
|---|
| 22 |  | 
|---|
| 23 | P:setButton(4, 1, { | 
|---|
| 24 | ["button"] = winMgr:getWindow("orxonox/SettingsButton"), | 
|---|
| 25 | ["callback"]  = P.SettingsButton_clicked | 
|---|
| 26 | }) | 
|---|
| 27 |  | 
|---|
| 28 | P:setButton(5, 1, { | 
|---|
| 29 | ["button"] = winMgr:getWindow("orxonox/CreditsButton"), | 
|---|
| 30 | ["callback"]  = P.CreditsButton_clicked | 
|---|
| 31 | }) | 
|---|
| 32 |  | 
|---|
| 33 | P:setButton(6, 1, { | 
|---|
| 34 | ["button"] = winMgr:getWindow("orxonox/ExitButton"), | 
|---|
| 35 | ["callback"]  = P.ExitButton_clicked | 
|---|
| 36 | }) | 
|---|
| 37 | end | 
|---|
| 38 |  | 
|---|
| 39 | -- events for MainMenu | 
|---|
| 40 | function P.QuickGameTestButton_clicked(e) | 
|---|
| 41 | hideAllMenuSheets() | 
|---|
| 42 | orxonox.execute("startGame") | 
|---|
| 43 | end | 
|---|
| 44 |  | 
|---|
| 45 | function P.SingleplayerButton_clicked(e) | 
|---|
| 46 | showMenuSheet("SingleplayerMenu", true) | 
|---|
| 47 | end | 
|---|
| 48 |  | 
|---|
| 49 | function P.MultiplayerButton_clicked(e) | 
|---|
| 50 | showMenuSheet("MultiplayerMenu", true) | 
|---|
| 51 | end | 
|---|
| 52 |  | 
|---|
| 53 | function P.SettingsButton_clicked(e) | 
|---|
| 54 | showMenuSheet("SettingsMenu", true) | 
|---|
| 55 | end | 
|---|
| 56 |  | 
|---|
| 57 | function P.CreditsButton_clicked(e) | 
|---|
| 58 | showMenuSheet("CreditsMenu", true) | 
|---|
| 59 | end | 
|---|
| 60 |  | 
|---|
| 61 | function P.ExitButton_clicked(e) | 
|---|
| 62 | orxonox.execute("exit") | 
|---|
| 63 | end | 
|---|
| 64 |  | 
|---|
| 65 | return P | 
|---|
| 66 |  | 
|---|