Last change
on this file since 6595 was
6595,
checked in by rgrieder, 15 years ago
|
Merged remaining revisions from gamestate to gamestates2.
|
-
Property svn:eol-style set to
native
|
File size:
1.1 KB
|
Rev | Line | |
---|
[5491] | 1 | -- gui.lua |
---|
| 2 | |
---|
| 3 | local P = {} |
---|
| 4 | if _REQUIREDNAME == nil then |
---|
[5661] | 5 | BasicGUI = P |
---|
[5491] | 6 | else |
---|
| 7 | _G[_REQUIREDNAME] = P |
---|
| 8 | end |
---|
| 9 | |
---|
[6595] | 10 | -- useless, even wrong? P is the class, not the object.. |
---|
[5491] | 11 | P.overlay = nil |
---|
| 12 | |
---|
| 13 | -- constructor of the GUI |
---|
[6595] | 14 | function P:new(_filename, _gui, _visible) |
---|
| 15 | local newElement = { |
---|
| 16 | filename = _filename, |
---|
| 17 | gui = _gui, |
---|
| 18 | visible = _visible or false |
---|
| 19 | } or {} |
---|
[5491] | 20 | setmetatable(newElement, self) -- connects new element with class |
---|
| 21 | self.__index = self |
---|
| 22 | return newElement |
---|
| 23 | end |
---|
| 24 | |
---|
[6595] | 25 | -- Override this function if you need to |
---|
[5523] | 26 | function P:init() |
---|
| 27 | end |
---|
| 28 | |
---|
[6595] | 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 | |
---|
[5491] | 35 | -- hide function for the GUI |
---|
[6595] | 36 | function P:hide() |
---|
[5491] | 37 | self.window:hide() |
---|
| 38 | self.visible = false |
---|
| 39 | end |
---|
| 40 | |
---|
| 41 | -- show function for the GUI |
---|
[6595] | 42 | function P:show() |
---|
[5491] | 43 | self.window:show() |
---|
| 44 | self.visible = true |
---|
| 45 | end |
---|
| 46 | |
---|
[6595] | 47 | function P:load() |
---|
| 48 | self.window = winMgr:loadWindowLayout(self.filename .. ".layout") |
---|
| 49 | self:createInputState() |
---|
[5559] | 50 | self:init() |
---|
| 51 | return self |
---|
[5491] | 52 | end |
---|
| 53 | |
---|
[5661] | 54 | return P |
---|
Note: See
TracBrowser
for help on using the repository browser.