[5491] | 1 | local schemeMgr = CEGUI.SchemeManager:getSingleton() |
---|
| 2 | winMgr = CEGUI.WindowManager:getSingleton() |
---|
| 3 | local logger = CEGUI.Logger:getSingleton() |
---|
| 4 | local system = CEGUI.System:getSingleton() |
---|
| 5 | local cursor = CEGUI.MouseCursor:getSingleton() |
---|
| 6 | |
---|
| 7 | schemeMgr:loadScheme("TaharezLookSkin.scheme") |
---|
| 8 | -- load scheme with our own images |
---|
| 9 | schemeMgr:loadScheme("OrxonoxGUIScheme.scheme") |
---|
| 10 | |
---|
| 11 | system:setDefaultMouseCursor("TaharezLook", "MouseArrow") |
---|
| 12 | system:setDefaultFont("BlueHighway-12") |
---|
[5527] | 13 | system:setDefaultTooltip("TaharezLook/Tooltip") |
---|
[5491] | 14 | |
---|
| 15 | loadedGUIs = {} |
---|
| 16 | |
---|
| 17 | -- loads the GUI with the specified filename |
---|
| 18 | -- be sure to set the global variable "filename" before calling this function |
---|
| 19 | function loadGUI(filename) |
---|
| 20 | -- check if it already exists |
---|
| 21 | loadedGui = loadedGUIs[filename] |
---|
| 22 | if loadedGui == nil then |
---|
| 23 | loadedGuiNS = require(filename) |
---|
| 24 | loadedGui = loadedGuiNS:load() |
---|
| 25 | loadedGUIs[filename] = loadedGui |
---|
| 26 | -- if there has no GUI been loaded yet, set new GUI as current |
---|
[5580] | 27 | if table.getn(loadedGUIs) == 1 then |
---|
[5491] | 28 | current = loadedGUIs[1] |
---|
| 29 | showing = false |
---|
| 30 | end |
---|
| 31 | -- hide new GUI as we do not want to show it accidentially |
---|
| 32 | loadedGui:hide() |
---|
| 33 | end |
---|
| 34 | return loadedGui |
---|
| 35 | end |
---|
| 36 | |
---|
| 37 | function showGUI(filename, ptr) |
---|
| 38 | gui = showGUI(filename) |
---|
| 39 | gui.overlay = ptr |
---|
| 40 | end |
---|
| 41 | |
---|
| 42 | -- shows the specified and loads it if not loaded already |
---|
| 43 | -- be sure to set the global variable "filename" before calling this function |
---|
| 44 | 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) |
---|
| 51 | end |
---|
| 52 | current:show() |
---|
| 53 | 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 |
---|
| 68 | end |
---|
| 69 | |
---|
| 70 | function hideCursor() |
---|
| 71 | cursor:hide() |
---|
| 72 | end |
---|
| 73 | |
---|
| 74 | function showCursor() |
---|
| 75 | cursor:show() |
---|
| 76 | end |
---|
| 77 | |
---|
| 78 | function hideGUI(filename) |
---|
| 79 | current = loadedGUIs[filename] |
---|
| 80 | if current ~= nil then |
---|
| 81 | current:hide() |
---|
| 82 | showing = false |
---|
| 83 | end |
---|
| 84 | end |
---|