Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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

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

added some gui stuff. Standard stuff from Ogre media repo plus a lua script file.

File size: 1.9 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.4, 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")
28
29rootSheet:addChildWindow(quit)
30rootSheet:addChildWindow(start)
31background:addChildWindow(rootSheet)
32
33
34function button_quit_clicked(e)
35  orxonox.CommandExecutor:execute("exit")
36end
37
38function button_start_clicked(e)
39  --orxonox.CommandExecutor:execute("loadGame standalone")
40  hideGUI()
41  orxonox.CommandExecutor:execute("openConsole")
42end
43
44local showBackground = false
45
46function showMainMenu()
47  if showBackground == true then
48    system:setGUISheet(background)
49  else
50    system:setGUISheet(rootSheet)
51  end
52  return 0;
53end
54
55function hideGUI()
56  system:setGUISheet(nil)
57  orxonox.GUIManager:getInstance():_hideGUI()
58end
Note: See TracBrowser for help on using the repository browser.