Changeset 6003 for code/branches/ingamemenu/data/gui/scripts
- Timestamp:
- Oct 28, 2009, 5:58:11 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/ingamemenu/data/gui/scripts/InitialiseGUI.lua
r5781 r6003 14 14 15 15 loadedGUIs = {} 16 root = nil; 16 17 17 18 -- loads the GUI with the specified filename … … 43 44 -- be sure to set the global variable "filename" before calling this function 44 45 function showGUI(filename) 45 if current == nil or current.filename ~= filename then 46 current = loadedGUIs[filename] 47 if current == nil then 48 current = loadGUI(filename) 49 end 50 system:setGUISheet(current.window) 46 if root == nil then 47 root = winMgr:createWindow("TaharezLook/StaticImage", "AbsoluteRootWindow") 48 root:setProperty("Alpha", "0.0") 49 root:setSize(CEGUI.UVector2(CEGUI.UDim(1.0,0),CEGUI.UDim(1.0,0))) 50 system:setGUISheet(root) 51 51 end 52 current:show() 52 53 local currentGUI = loadedGUIs[filename] 54 if(currentGUI == nil) then 55 currentGUI = loadGUI(filename) 56 end 57 58 if(root:isChild(currentGUI.window)) then 59 root:removeChildWindow(currentGUI.window) 60 end 61 root:addChildWindow(currentGUI.window) 62 63 currentGUI:show() 53 64 showing = true 54 return current 55 end 56 57 function toggleGUI() 58 if showing == true then 59 current:hide() 60 cursor:hide() 61 showing = false 62 else 63 current:show() 64 cursor:show() 65 showing = true 66 end 67 return showing 65 return currentGUI 68 66 end 69 67 … … 77 75 78 76 function hideGUI(filename) 79 current = loadedGUIs[filename] 80 if current ~= nil then 81 current:hide() 77 local currentGUI = loadedGUIs[filename] 78 if currentGUI ~= nil then 79 currentGUI:hide() 80 root:removeChildWindow(currentGUI.window) 82 81 showing = false 83 82 end
Note: See TracChangeset
for help on using the changeset viewer.