Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: data/Media/gui/scripts/loadGUI.lua @ 5164

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

some adjustments to the c++ code

File size: 2.2 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.6, 0)))
17quit:subscribeEvent("Clicked","button_quit_clicked")
18
19local start = winMgr:createWindow("TaharezLook/Button", "orxonox/StartButton")
20start:setText("Start")
21start:setSize(CEGUI.UVector2(CEGUI.UDim(0.15, 0), CEGUI.UDim(0.05, 0)))
22start:setPosition(CEGUI.UVector2(CEGUI.UDim(0.4, 0), CEGUI.UDim(0.3, 0)))
23start:subscribeEvent("Clicked","button_start_clicked")
24
25local backgroundImage = CEGUI.ImagesetManager:getSingleton():createImagesetFromImageFile("GUI/Background", "sample_loading.jpg")
26local background = winMgr:createWindow("TaharezLook/StaticImage", "orxonox/Background")
27background:setProperty("Image", "set: GUI/Background image:full_image")
28background:subscribeEvent("CharacterKey", "key_pressed")
29
30rootSheet:addChildWindow(quit)
31rootSheet:addChildWindow(start)
32background:addChildWindow(rootSheet)
33
34
35function button_quit_clicked(e)
36  hideGUI()
37  orxonox.CommandExecutor:execute("exit")
38end
39
40function button_start_clicked(e)
41  orxonox.CommandExecutor:execute("selectGameState standalone")
42  hideGUI()
43  --orxonox.CommandExecutor:execute("openConsole")
44end
45
46function key_pressed(e)
47  keyevent = tolua.cast(e, "CEGUI::KeyEventArgs")
48  if keyevent.codepoint == 167 then
49    orxonox.CommandExecutor:execute("openConsole")
50  end
51end
52
53showBackground = false
54
55function showMainMenu()
56  if showBackground == true then
57    system:setGUISheet(background)
58  else
59    system:setGUISheet(rootSheet)
60  end
61  return 0;
62end
63
64function hideGUI()
65  system:setGUISheet(nil)
66  orxonox.GUIManager:getInstance():hideGUI()
67end
Note: See TracBrowser for help on using the repository browser.