Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/branches/gamestate/data/gui/scripts/BasicGUI.lua @ 6537

Last change on this file since 6537 was 6537, checked in by rgrieder, 14 years ago

Linked every GUI sheet to exactly one InputState.
Also added util/TriBool that has states {true, false, Dontcare}.

  • Property svn:eol-style set to native
File size: 1.1 KB
Line 
1-- gui.lua
2
3local P = {}
4if _REQUIREDNAME == nil then
5    BasicGUI = P
6else
7    _G[_REQUIREDNAME] = P
8end
9
10-- useless, even wrong? P is the class, not the object..
11P.overlay = nil
12
13-- constructor of the GUI
14function P:new(_filename, _gui, _visible)
15    local newElement = {
16        filename = _filename,
17        gui = _gui,
18        visible = _visible or false
19    } or {}
20    setmetatable(newElement, self) -- connects new element with class
21    self.__index = self
22    return newElement
23end
24
25-- Override this function if you need to
26function P:init()
27end
28
29-- Override this function if you need to
30-- But don't forget to stick to the naming convention ("GUI_" .. self.filename)
31function P:createInputState()
32    self.inputState = guiMgr:createInputState("GUI_" .. self.filename)
33end
34
35-- hide function for the GUI
36function P:hide()
37    self.window:hide()
38    self.visible = false
39end
40
41-- show function for the GUI
42function P:show()
43    self.window:show()
44    self.visible = true
45end
46
47function P:load()
48    self.window = winMgr:loadWindowLayout(self.filename .. ".layout")
49    self:createInputState()
50    self:init()
51    return self
52end
53
54return P
Note: See TracBrowser for help on using the repository browser.