Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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

Last change on this file since 5414 was 5414, checked in by bknecht, 15 years ago

Removed layout information to actual .layout file and leaving functions and script stuff in the lua-file. There is still some work to do to properly load layouts and call the correct functions, but it's more cleaned up now, but also more spread of corse.

File size: 2.1 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 mainmenu =  winMgr:loadWindowLayout("MainMenu.layout")
12
13local backgroundImage = CEGUI.ImagesetManager:getSingleton():createImagesetFromImageFile("GUI/Background", "main_menu_1.jpg")
14local background = winMgr:createWindow("TaharezLook/StaticImage", "orxonox/Background")
15background:setProperty("FrameEnabled", "set: true")
16background:setProperty("BackgroundEnabled", "set: false")
17background:setProperty("Image", "set: GUI/Background image:full_image")
18
19background:addChildWindow(mainmenu)
20
21
22function button_quit_clicked(e)
23  hideGUI()
24  orxonox.CommandExecutor:execute("exit")
25end
26
27function button_standalone_clicked(e)
28  orxonox.CommandExecutor:execute("selectGameState standalone")
29  hideGUI()
30end
31
32function button_server_clicked(e)
33  orxonox.CommandExecutor:execute("selectGameState server")
34  hideGUI()
35end
36
37function button_dedicated_clicked(e)
38  orxonox.CommandExecutor:execute("selectGameState dedicated")
39  hideGUI()
40end
41
42function button_client_clicked(e)
43  orxonox.CommandExecutor:execute("selectGameState client")
44  hideGUI()
45end
46
47showBackground = true
48
49function showMainMenu()
50  if showBackground == true then
51    system:setGUISheet(background)
52  else
53    orxonox.GUIManager:getInstance():testOutput("set new Menu")
54    system:setGUISheet(mainmenu)
55  end
56  return 0;
57end
58
59showing = true
60
61function toggleGUI()
62    if showing == true then
63        mainmenu:hide()
64        showing = false
65        orxonox.GUIManager:getInstance():testOutput("hiding Menu")
66    else
67        mainmenu:show()
68        showing = true
69        orxonox.GUIManager:getInstance():testOutput("showing Menu")
70    end
71end
72
73function hideGUI()
74  --system:setGUISheet(nil)
75  --orxonox.GUIManager:getInstance():hideGUI()
76end
Note: See TracBrowser for help on using the repository browser.