Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/branches/ggz2/data/gui/scripts/InitialiseGUI.lua @ 6500

Last change on this file since 6500 was 5695, checked in by rgrieder, 15 years ago

Merged resource2 branch back to trunk.

IMPORTANT NOTE:
Upon this merge you need to specifically call your data directory "data_extern" when checking it out (when you don't provide a name, it will be just called 'trunk').
The new CMake variable is EXTERNAL_DATA_DIRECTORY. DATA_DIRECTORY now points to the one the source part of the repository.
UPDATE YOUR DATA DIRECTORY AS WELL!!!

  • Property svn:eol-style set to native
File size: 2.2 KB
Line 
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")
13system:setDefaultTooltip("TaharezLook/Tooltip")
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
27        if table.getn(loadedGUIs) == 1 then
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.