Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/trunk/data/gui/scripts/InitialiseGUI.lua @ 5925

Last change on this file since 5925 was 5781, checked in by rgrieder, 15 years ago

Reverted trunk again. We might want to find a way to delete these revisions again (x3n's changes are still available as diff in the commit mails).

  • Property svn:eol-style set to native
File size: 2.2 KB
RevLine 
[5491]1local schemeMgr = CEGUI.SchemeManager:getSingleton()
2winMgr = CEGUI.WindowManager:getSingleton()
3local logger = CEGUI.Logger:getSingleton()
4local system = CEGUI.System:getSingleton()
5local cursor = CEGUI.MouseCursor:getSingleton()
6
7schemeMgr:loadScheme("TaharezLookSkin.scheme")
8-- load scheme with our own images
9schemeMgr:loadScheme("OrxonoxGUIScheme.scheme")
10
11system:setDefaultMouseCursor("TaharezLook", "MouseArrow")
12system:setDefaultFont("BlueHighway-12")
[5527]13system:setDefaultTooltip("TaharezLook/Tooltip")
[5491]14
15loadedGUIs = {}
16
17-- loads the GUI with the specified filename
18-- be sure to set the global variable "filename" before calling this function
19function 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
35end
36
37function showGUI(filename, ptr)
38    gui = showGUI(filename)
39    gui.overlay = ptr
40end
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
44function 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
55end
56
57function 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
68end
69
70function hideCursor()
71    cursor:hide()
72end
73
74function showCursor()
75    cursor:show()
76end
77
78function hideGUI(filename)
79    current = loadedGUIs[filename]
80    if current ~= nil then
81        current:hide()
82        showing = false
83    end
84end
Note: See TracBrowser for help on using the repository browser.