Changeset 6032 for code/branches/menu/data/gui
- Timestamp:
- Nov 4, 2009, 5:30:38 PM (15 years ago)
- Location:
- code/branches/menu/data/gui
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/menu/data/gui/layouts/MainMenu.layout
r6024 r6032 1 1 <?xml version="1.0" ?> 2 2 <GUILayout> 3 <Window Type="TaharezLook/StaticImage" Name="orxonox/Background"> 4 <Property Name="UnifiedSize" Value="{{1.0,0},{1.0,0}}"/> 5 <Property Name="Image" Value="set:MainMenuBackground image:Background"/> 6 <Property Name="FrameEnabled" Value="set:true"/> 7 <Property Name="BackgroundEnabled" Value="set:false"/> 8 <Property Name="InheritsAlpha" Value="False" /> 9 3 <Window Type="DefaultWindow" Name="orxonox/MainMenuRootWindow"> 4 <Property Name="InheritsAlpha" Value="false"/> 10 5 <Window Type="TaharezLook/Button" Name="orxonox/StandaloneButton"> 11 6 <Property Name="UnifiedPosition" Value="{{0.11,0},{0.3,0}}"/> -
code/branches/menu/data/gui/scripts/InitialiseGUI.lua
r6024 r6032 19 19 root = nil 20 20 bShowsCursor = false 21 bHidePrevious = {} 21 22 22 23 -- loads the GUI with the specified filename … … 32 33 if table.getn(loadedGUIs) == 1 then 33 34 current = loadedGUIs[1] 34 showing = false35 35 end 36 36 -- hide new GUI as we do not want to show it accidentially … … 40 40 end 41 41 42 function showGUI(filename, bCursorVisible, ptr)43 gui = showGUI(filename, bCursorVisible)42 function showGUI(filename, hidePrevious, bCursorVisible, ptr) 43 gui = showGUI(filename, hidePrevious, bCursorVisible) 44 44 gui.overlay = ptr 45 45 end … … 47 47 -- shows the specified and loads it if not loaded already 48 48 -- be sure to set the global variable "filename" before calling this function 49 function showGUI(filename, bCursorVisible) 50 -- bCursorVisibile=false 49 function showGUI(filename, hidePrevious, bCursorVisible) 51 50 if bCursorVisible == nil then 52 cursorVisibility= true51 bCursorVisible = true 53 52 end 54 53 55 54 if root == nil then 56 root = winMgr:createWindow("TaharezLook/StaticImage", "AbsoluteRootWindow") 57 root:setProperty("Alpha", "0.0") 58 root:setSize(CEGUI.UVector2(CEGUI.UDim(1.0,0),CEGUI.UDim(1.0,0))) 59 system:setGUISheet(root) 55 setBackground("") 60 56 end 61 57 … … 65 61 end 66 62 63 debug("test") 64 debug(currentGUI.window:getName()) 65 debug(root:isChild(currentGUI.window)) 67 66 if(root:isChild(currentGUI.window)) then 67 debug("removing window") 68 68 root:removeChildWindow(currentGUI.window) 69 69 end … … 75 75 hideCursor() 76 76 end 77 cursorVisibility[filename]=bCursorVisible78 77 78 if find( activeSheets, filename ) ~= nil then 79 table.remove( activeSheets, find( activeSheets, filename ) ) 80 nrOfActiveSheets = nrOfActiveSheets - 1 81 end 79 82 nrOfActiveSheets = nrOfActiveSheets + 1 80 83 table.insert(activeSheets, filename) 81 84 activeSheets[nrOfActiveSheets] = filename 85 bHidePrevious[filename]=hidePrevious 86 cursorVisibility[filename] = bCursorVisible 82 87 88 if hidePrevious == true then 89 for i=1,nrOfActiveSheets-1 do 90 loadedGUIs[ activeSheets[i] ]:hide() 91 end 92 end 83 93 currentGUI:show() 84 showing = true85 94 return currentGUI 86 95 end … … 106 115 end 107 116 currentGUI:hide() 117 if bHidePrevious[filename] == true then 118 local i = nrOfActiveSheets-1 119 while i>0 do 120 loadedGUIs[ activeSheets[i] ]:show() 121 if bHidePrevious[filename]==true then 122 break 123 else 124 i=i-1 125 end 126 end 127 end 108 128 root:removeChildWindow(currentGUI.window) 109 showing = false 110 i=1 129 local i=1 111 130 while activeSheets[i] do 112 131 if activeSheets[i+1] == nil then … … 129 148 end 130 149 cursorVisibility[filename] = nil -- remove the cursor visibility of the current gui from the table 150 bHidePrevious[filename] = nil 131 151 end 152 153 function setBackground(filename) 154 local newroot 155 if root ~= nil then 156 root:rename("oldRootWindow") 157 end 158 if filename ~= "" then 159 newroot = winMgr:loadWindowLayout(filename .. ".layout") 160 newroot:rename("AbsoluteRootWindow") 161 system:setGUISheet(newroot) 162 else 163 newroot = winMgr:createWindow("DefaultWindow", "AbsoluteRootWindow") 164 newroot:setProperty("Alpha", "0.0") 165 newroot:setSize(CEGUI.UVector2(CEGUI.UDim(1.0,0),CEGUI.UDim(1.0,0))) 166 system:setGUISheet(newroot) 167 end 168 if root ~= nil then 169 local child 170 for i=0,root:getChildCount()-1 do 171 child = root:getChildAtIdx(i) 172 root:removeChildWindow(child) 173 newroot:addChildWindow(child) 174 end 175 winMgr:destroyWindow(root) 176 end 177 newroot:show() 178 root = newroot 179 end 180 181 function find(table, value) 182 local i=0 183 while table[i] ~= nil do 184 if table[i]==value then 185 return i 186 else 187 i=i+1 188 end 189 end 190 return nil 191 end
Note: See TracChangeset
for help on using the changeset viewer.