Changeset 6023 for code/branches/ingamemenu/data/gui
- Timestamp:
- Nov 4, 2009, 1:59:39 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/ingamemenu/data/gui/scripts/InitialiseGUI.lua
r6003 r6023 14 14 15 15 loadedGUIs = {} 16 root = nil; 16 cursorVisibility = {} 17 activeSheets = {} 18 nrOfActiveSheets = 0 19 root = nil 20 bShowsCursor = false 17 21 18 22 -- loads the GUI with the specified filename … … 36 40 end 37 41 38 function showGUI(filename, ptr)39 gui = showGUI(filename )42 function showGUI(filename, bCursorVisible, ptr) 43 gui = showGUI(filename, bCursorVisible) 40 44 gui.overlay = ptr 41 45 end … … 43 47 -- shows the specified and loads it if not loaded already 44 48 -- be sure to set the global variable "filename" before calling this function 45 function showGUI(filename) 49 function showGUI(filename, bCursorVisible) 50 -- bCursorVisibile=false 51 if bCursorVisible == nil then 52 cursorVisibility= true 53 end 54 46 55 if root == nil then 47 56 root = winMgr:createWindow("TaharezLook/StaticImage", "AbsoluteRootWindow") … … 61 70 root:addChildWindow(currentGUI.window) 62 71 72 if bCursorVisible then 73 showCursor() 74 else 75 hideCursor() 76 end 77 cursorVisibility[filename]=bCursorVisible 78 79 nrOfActiveSheets = nrOfActiveSheets + 1 80 table.insert(activeSheets, filename) 81 activeSheets[nrOfActiveSheets] = filename 82 63 83 currentGUI:show() 64 84 showing = true … … 67 87 68 88 function hideCursor() 69 cursor:hide() 89 if bShowsCursor==true then 90 bShowsCursor=false 91 cursor:hide() 92 end 70 93 end 71 94 72 95 function showCursor() 73 cursor:show() 96 if bShowsCursor==false then 97 bShowsCursor=true 98 cursor:show() 99 end 74 100 end 75 101 76 102 function hideGUI(filename) 77 103 local currentGUI = loadedGUIs[filename] 78 if currentGUI ~= nil then 79 currentGUI:hide() 80 root:removeChildWindow(currentGUI.window) 81 showing = false 104 if currentGUI == nil then 105 return 82 106 end 107 currentGUI:hide() 108 root:removeChildWindow(currentGUI.window) 109 showing = false 110 i=1 111 while activeSheets[i] do 112 if activeSheets[i+1] == nil then 113 if activeSheets[i-1] ~= nil then 114 if cursorVisibility[ activeSheets[i-1] ] == true then 115 showCursor() 116 else 117 hideCursor() 118 end 119 else 120 hideCursor() 121 end 122 end 123 if activeSheets[i] == filename then 124 table.remove( activeSheets, i ) 125 nrOfActiveSheets = nrOfActiveSheets-1 126 else 127 i = i+1 128 end 129 end 130 cursorVisibility[filename] = nil -- remove the cursor visibility of the current gui from the table 83 131 end
Note: See TracChangeset
for help on using the changeset viewer.