Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/trunk/data/gui/scripts/MainMenu.lua @ 7726

Last change on this file since 7726 was 7689, checked in by dafrick, 14 years ago

Merging menu branch to trunk.

  • Property svn:eol-style set to native
File size: 2.0 KB
RevLine 
[5661]1-- MainMenu.lua
[5491]2
[6746]3local P = createMenuSheet("MainMenu")
[6748]4P.loadAlong = { "SingleplayerMenu", "MultiplayerMenu", "SettingsMenu", "CreditsMenu" }
[5491]5
[7689]6P.buttonList = {}
7
8function P.onLoad()
9    --buttons are arranged in a 6x1 Matrix (list)
10    local item = {
11            ["button"] = winMgr:getWindow("orxonox/QuickGameTestButton"),
12            ["function"]  = P.QuickGameTestButton_clicked
13    }
14    table.insert(P.buttonList,item)
15
16    item = {
17            ["button"] = winMgr:getWindow("orxonox/SingleplayerButton"),
18            ["function"]  = P.SingleplayerButton_clicked
19    }
20    table.insert(P.buttonList,item)
21
22    item = {
23            ["button"] = winMgr:getWindow("orxonox/MultiplayerButton"),
24            ["function"]  = P.MultiplayerButton_clicked
25    }
26    table.insert(P.buttonList,item)
27
28    item = {
29            ["button"] = winMgr:getWindow("orxonox/SettingsButton"),
30            ["function"]  = P.SettingsButton_clicked
31    }
32    table.insert(P.buttonList,item)
33
34    item = {
35            ["button"] = winMgr:getWindow("orxonox/CreditsButton"),
36            ["function"]  = P.CreditsButton_clicked
37    }
38    table.insert(P.buttonList,item)
39
40    item = {
41            ["button"] = winMgr:getWindow("orxonox/ExitButton"),
42            ["function"]  = P.ExitButton_clicked
43    }
44    table.insert(P.buttonList,item) 
45end
46
47function P.onShow()
48    --indices to iterate through buttonlist
49    P.oldindex = -2
50    P.index = -1
51end
52
[6417]53-- events for MainMenu
54function P.QuickGameTestButton_clicked(e)
[7163]55    hideAllMenuSheets()
[6417]56    orxonox.execute("startGame")
[5491]57end
58
[6417]59function P.SingleplayerButton_clicked(e)
[6746]60    showMenuSheet("SingleplayerMenu", true)
[5491]61end
62
[6417]63function P.MultiplayerButton_clicked(e)
[6746]64    showMenuSheet("MultiplayerMenu", true)
[5491]65end
66
[6417]67function P.SettingsButton_clicked(e)
[6746]68    showMenuSheet("SettingsMenu", true)
[5491]69end
70
[6417]71function P.CreditsButton_clicked(e)
[6746]72    showMenuSheet("CreditsMenu", true)
[5491]73end
74
[6417]75function P.ExitButton_clicked(e)
76    orxonox.execute("exit")
[5491]77end
78
[7689]79function P.onKeyPressed() 
80    buttonIteratorHelper(P.buttonList, code, P, 6, 1)
81end
82
[5661]83return P
[5491]84
Note: See TracBrowser for help on using the repository browser.