Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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

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

Simplified BasicGUI construction. Just give the name of the GUI as argument. The rest will be deduced.

  • Property svn:eol-style set to native
File size: 870 bytes
Line 
1-- gui.lua
2
3local P = {}
4if _REQUIREDNAME == nil then
5    BasicGUI = P
6else
7    _G[_REQUIREDNAME] = P
8end
9
10-- useless?
11P.overlay = nil
12
13-- constructor of the GUI
14function P:new(_filename, _visible, _gui)
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
25function P:init()
26-- this function is empty and intended for inheriting GUIs to use
27end
28
29-- hide function for the GUI
30function P:hide()
31    self.window:hide()
32    self.visible = false
33end
34
35-- show function for the GUI
36function P:show()
37    self.window:show()
38    self.visible = true
39end
40
41function P:load()
42    self.window = winMgr:loadWindowLayout(self.filename .. ".layout")
43    self:init()
44    return self
45end
46
47return P
Note: See TracBrowser for help on using the repository browser.