Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: data/media/gui/scripts/loadGUI.lua @ 5285

Last change on this file since 5285 was 5261, checked in by rgrieder, 16 years ago

Removed ugly console open hack in loadGuI.lua

File size: 3.3 KB
Line 
1local schemeMgr = CEGUI.SchemeManager:getSingleton()
2local winMgr = CEGUI.WindowManager:getSingleton()
3local logger = CEGUI.Logger:getSingleton()
4local system = CEGUI.System:getSingleton()
5
6schemeMgr:loadScheme("TaharezLookSkin.scheme")
7system:setDefaultMouseCursor("TaharezLook", "MouseArrow")
8system:setDefaultFont("BlueHighway-12")
9
10
11local rootSheet = winMgr:createWindow("DefaultGUISheet", "orxonox/Sheet")
12
13local quit = winMgr:createWindow("TaharezLook/Button", "orxonox/QuitButton")
14quit:setText("Quit")
15quit:setSize(CEGUI.UVector2(CEGUI.UDim(0.15, 0), CEGUI.UDim(0.05, 0)))
16quit:setPosition(CEGUI.UVector2(CEGUI.UDim(0.4, 0), CEGUI.UDim(0.7, 0)))
17quit:subscribeEvent("Clicked","button_quit_clicked")
18
19local standalone = winMgr:createWindow("TaharezLook/Button", "orxonox/StandaloneButton")
20standalone:setText("Standalone")
21standalone:setSize(CEGUI.UVector2(CEGUI.UDim(0.15, 0), CEGUI.UDim(0.05, 0)))
22standalone:setPosition(CEGUI.UVector2(CEGUI.UDim(0.4, 0), CEGUI.UDim(0.3, 0)))
23standalone:subscribeEvent("Clicked","button_standalone_clicked")
24
25local dedicated = winMgr:createWindow("TaharezLook/Button", "orxonox/DedicatedButton")
26dedicated:setText("Dedicated")
27dedicated:setSize(CEGUI.UVector2(CEGUI.UDim(0.15, 0), CEGUI.UDim(0.05, 0)))
28dedicated:setPosition(CEGUI.UVector2(CEGUI.UDim(0.4, 0), CEGUI.UDim(0.4, 0)))
29dedicated:subscribeEvent("Clicked","button_dedicated_clicked")
30
31local server = winMgr:createWindow("TaharezLook/Button", "orxonox/ServerButton")
32server:setText("Server")
33server:setSize(CEGUI.UVector2(CEGUI.UDim(0.15, 0), CEGUI.UDim(0.05, 0)))
34server:setPosition(CEGUI.UVector2(CEGUI.UDim(0.4, 0), CEGUI.UDim(0.5, 0)))
35server:subscribeEvent("Clicked","button_server_clicked")
36
37local client = winMgr:createWindow("TaharezLook/Button", "orxonox/ClientButton")
38client:setText("Client")
39client:setSize(CEGUI.UVector2(CEGUI.UDim(0.15, 0), CEGUI.UDim(0.05, 0)))
40client:setPosition(CEGUI.UVector2(CEGUI.UDim(0.4, 0), CEGUI.UDim(0.6, 0)))
41client:subscribeEvent("Clicked","button_client_clicked")
42
43local backgroundImage = CEGUI.ImagesetManager:getSingleton():createImagesetFromImageFile("GUI/Background", "sample_loading.jpg")
44local background = winMgr:createWindow("TaharezLook/StaticImage", "orxonox/Background")
45background:setProperty("Image", "set: GUI/Background image:full_image")
46
47rootSheet:addChildWindow(quit)
48rootSheet:addChildWindow(standalone)
49rootSheet:addChildWindow(server)
50rootSheet:addChildWindow(dedicated)
51rootSheet:addChildWindow(client)
52background:addChildWindow(rootSheet)
53
54
55function button_quit_clicked(e)
56  hideGUI()
57  orxonox.CommandExecutor:execute("exit")
58end
59
60function button_standalone_clicked(e)
61  orxonox.CommandExecutor:execute("selectGameState standalone")
62  hideGUI()
63end
64
65function button_server_clicked(e)
66  orxonox.CommandExecutor:execute("selectGameState server")
67  hideGUI()
68end
69
70function button_dedicated_clicked(e)
71  orxonox.CommandExecutor:execute("selectGameState dedicated")
72  hideGUI()
73end
74
75function button_client_clicked(e)
76  orxonox.CommandExecutor:execute("selectGameState client")
77  hideGUI()
78end
79
80showBackground = false
81
82function showMainMenu()
83  if showBackground == true then
84    system:setGUISheet(background)
85  else
86    system:setGUISheet(rootSheet)
87  end
88  return 0;
89end
90
91function hideGUI()
92  system:setGUISheet(nil)
93  orxonox.GUIManager:getInstance():hideGUI()
94end
Note: See TracBrowser for help on using the repository browser.