Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/branches/gamestates2/data/gui/scripts/BasicGUI.lua @ 6595

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
RevLine 
[5491]1-- gui.lua
2
3local P = {}
4if _REQUIREDNAME == nil then
[5661]5    BasicGUI = P
[5491]6else
7    _G[_REQUIREDNAME] = P
8end
9
[6595]10-- useless, even wrong? P is the class, not the object..
[5491]11P.overlay = nil
12
13-- constructor of the GUI
[6595]14function 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
23end
24
[6595]25-- Override this function if you need to
[5523]26function P:init()
27end
28
[6595]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
[6595]36function P:hide()
[5491]37    self.window:hide()
38    self.visible = false
39end
40
41-- show function for the GUI
[6595]42function P:show()
[5491]43    self.window:show()
44    self.visible = true
45end
46
[6595]47function P:load()
48    self.window = winMgr:loadWindowLayout(self.filename .. ".layout")
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.