Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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

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

Removed ugly console open hack in loadGuI.lua

File size: 3.3 KB
RevLine 
[5162]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)))
[5236]16quit:setPosition(CEGUI.UVector2(CEGUI.UDim(0.4, 0), CEGUI.UDim(0.7, 0)))
[5162]17quit:subscribeEvent("Clicked","button_quit_clicked")
18
[5165]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")
[5162]24
[5236]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
[5165]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)))
[5236]34server:setPosition(CEGUI.UVector2(CEGUI.UDim(0.4, 0), CEGUI.UDim(0.5, 0)))
[5165]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)))
[5236]40client:setPosition(CEGUI.UVector2(CEGUI.UDim(0.4, 0), CEGUI.UDim(0.6, 0)))
[5165]41client:subscribeEvent("Clicked","button_client_clicked")
42
[5162]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)
[5165]48rootSheet:addChildWindow(standalone)
49rootSheet:addChildWindow(server)
[5236]50rootSheet:addChildWindow(dedicated)
[5165]51rootSheet:addChildWindow(client)
[5162]52background:addChildWindow(rootSheet)
53
54
55function button_quit_clicked(e)
[5163]56  hideGUI()
[5162]57  orxonox.CommandExecutor:execute("exit")
58end
59
[5165]60function button_standalone_clicked(e)
[5164]61  orxonox.CommandExecutor:execute("selectGameState standalone")
[5162]62  hideGUI()
63end
64
[5165]65function button_server_clicked(e)
66  orxonox.CommandExecutor:execute("selectGameState server")
67  hideGUI()
68end
69
[5236]70function button_dedicated_clicked(e)
71  orxonox.CommandExecutor:execute("selectGameState dedicated")
72  hideGUI()
73end
74
[5165]75function button_client_clicked(e)
76  orxonox.CommandExecutor:execute("selectGameState client")
77  hideGUI()
78end
79
[5163]80showBackground = false
[5162]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)
[5164]93  orxonox.GUIManager:getInstance():hideGUI()
[5162]94end
Note: See TracBrowser for help on using the repository browser.