Last change
on this file since 6571 was
6537,
checked in by rgrieder, 15 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 | |
---|
3 | local P = {} |
---|
4 | if _REQUIREDNAME == nil then |
---|
5 | BasicGUI = P |
---|
6 | else |
---|
7 | _G[_REQUIREDNAME] = P |
---|
8 | end |
---|
9 | |
---|
10 | -- useless, even wrong? P is the class, not the object.. |
---|
11 | P.overlay = nil |
---|
12 | |
---|
13 | -- constructor of the GUI |
---|
14 | function 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 |
---|
23 | end |
---|
24 | |
---|
25 | -- Override this function if you need to |
---|
26 | function P:init() |
---|
27 | end |
---|
28 | |
---|
29 | -- Override this function if you need to |
---|
30 | -- But don't forget to stick to the naming convention ("GUI_" .. self.filename) |
---|
31 | function P:createInputState() |
---|
32 | self.inputState = guiMgr:createInputState("GUI_" .. self.filename) |
---|
33 | end |
---|
34 | |
---|
35 | -- hide function for the GUI |
---|
36 | function P:hide() |
---|
37 | self.window:hide() |
---|
38 | self.visible = false |
---|
39 | end |
---|
40 | |
---|
41 | -- show function for the GUI |
---|
42 | function P:show() |
---|
43 | self.window:show() |
---|
44 | self.visible = true |
---|
45 | end |
---|
46 | |
---|
47 | function P:load() |
---|
48 | self.window = winMgr:loadWindowLayout(self.filename .. ".layout") |
---|
49 | self:createInputState() |
---|
50 | self:init() |
---|
51 | return self |
---|
52 | end |
---|
53 | |
---|
54 | return P |
---|
Note: See
TracBrowser
for help on using the repository browser.