Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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

Last change on this file since 6551 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
RevLine 
[5491]1-- gui.lua
2
3local P = {}
4if _REQUIREDNAME == nil then
[5661]5    BasicGUI = P
[5491]6else
7    _G[_REQUIREDNAME] = P
8end
9
[6537]10-- useless, even wrong? P is the class, not the object..
[5491]11P.overlay = nil
12
13-- constructor of the GUI
[6537]14function P:new(_filename, _gui, _visible)
[6459]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
23end
24
[6537]25-- Override this function if you need to
[5523]26function P:init()
27end
28
[6537]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
[5491]35-- hide function for the GUI
[6459]36function P:hide()
[5491]37    self.window:hide()
38    self.visible = false
39end
40
41-- show function for the GUI
[6459]42function P:show()
[5491]43    self.window:show()
44    self.visible = true
45end
46
[6459]47function P:load()
48    self.window = winMgr:loadWindowLayout(self.filename .. ".layout")
[6537]49    self:createInputState()
[5559]50    self:init()
51    return self
[5491]52end
53
[5661]54return P
Note: See TracBrowser for help on using the repository browser.