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