1 | local schemeMgr = CEGUI.SchemeManager:getSingleton() |
---|
2 | local winMgr = CEGUI.WindowManager:getSingleton() |
---|
3 | local logger = CEGUI.Logger:getSingleton() |
---|
4 | local system = CEGUI.System:getSingleton() |
---|
5 | |
---|
6 | schemeMgr:loadScheme("TaharezLookSkin.scheme") |
---|
7 | system:setDefaultMouseCursor("TaharezLook", "MouseArrow") |
---|
8 | system:setDefaultFont("BlueHighway-12") |
---|
9 | |
---|
10 | |
---|
11 | local rootSheet = winMgr:createWindow("DefaultGUISheet", "orxonox/Sheet") |
---|
12 | |
---|
13 | local quit = winMgr:createWindow("TaharezLook/Button", "orxonox/QuitButton") |
---|
14 | quit:setText("Quit") |
---|
15 | quit:setSize(CEGUI.UVector2(CEGUI.UDim(0.15, 0), CEGUI.UDim(0.05, 0))) |
---|
16 | quit:setPosition(CEGUI.UVector2(CEGUI.UDim(0.4, 0), CEGUI.UDim(0.6, 0))) |
---|
17 | quit:subscribeEvent("Clicked","button_quit_clicked") |
---|
18 | |
---|
19 | local start = winMgr:createWindow("TaharezLook/Button", "orxonox/StartButton") |
---|
20 | start:setText("Start") |
---|
21 | start:setSize(CEGUI.UVector2(CEGUI.UDim(0.15, 0), CEGUI.UDim(0.05, 0))) |
---|
22 | start:setPosition(CEGUI.UVector2(CEGUI.UDim(0.4, 0), CEGUI.UDim(0.3, 0))) |
---|
23 | start:subscribeEvent("Clicked","button_start_clicked") |
---|
24 | |
---|
25 | local backgroundImage = CEGUI.ImagesetManager:getSingleton():createImagesetFromImageFile("GUI/Background", "sample_loading.jpg") |
---|
26 | local background = winMgr:createWindow("TaharezLook/StaticImage", "orxonox/Background") |
---|
27 | background:setProperty("Image", "set: GUI/Background image:full_image") |
---|
28 | background:subscribeEvent("CharacterKey", "key_pressed") |
---|
29 | |
---|
30 | rootSheet:addChildWindow(quit) |
---|
31 | rootSheet:addChildWindow(start) |
---|
32 | background:addChildWindow(rootSheet) |
---|
33 | |
---|
34 | |
---|
35 | function button_quit_clicked(e) |
---|
36 | hideGUI() |
---|
37 | orxonox.CommandExecutor:execute("exit") |
---|
38 | end |
---|
39 | |
---|
40 | function button_start_clicked(e) |
---|
41 | orxonox.CommandExecutor:execute("selectGameState standalone") |
---|
42 | hideGUI() |
---|
43 | --orxonox.CommandExecutor:execute("openConsole") |
---|
44 | end |
---|
45 | |
---|
46 | function key_pressed(e) |
---|
47 | keyevent = tolua.cast(e, "CEGUI::KeyEventArgs") |
---|
48 | if keyevent.codepoint == 167 then |
---|
49 | orxonox.CommandExecutor:execute("openConsole") |
---|
50 | end |
---|
51 | end |
---|
52 | |
---|
53 | showBackground = false |
---|
54 | |
---|
55 | function showMainMenu() |
---|
56 | if showBackground == true then |
---|
57 | system:setGUISheet(background) |
---|
58 | else |
---|
59 | system:setGUISheet(rootSheet) |
---|
60 | end |
---|
61 | return 0; |
---|
62 | end |
---|
63 | |
---|
64 | function hideGUI() |
---|
65 | system:setGUISheet(nil) |
---|
66 | orxonox.GUIManager:getInstance():hideGUI() |
---|
67 | end |
---|