Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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

Last change on this file since 6659 was 6621, checked in by rgrieder, 15 years ago

Simplified GUI sheet creation (first lines in the lua file) a lot by exporting it to GUITools.lua

  • Property svn:eol-style set to native
File size: 1.2 KB
Line 
1-- BasicGUI.lua
2
3local P = {}
4_G[_REQUIREDNAME or "BasicGUI"] = P
5
6-- useless, even wrong? P is the class, not the object..
7P.overlay = nil
8
9-- constructor of the GUI
10function P:new(_filename, _gui, _visible)
11    local newElement = {
12        filename = _filename,
13        gui = _gui,
14        visible = _visible or false
15    } or {}
16    setmetatable(newElement, self) -- connects new element with class
17    self.__index = self
18    return newElement
19end
20
21-- Override this function if you need to
22function P:init()
23end
24
25-- Override this function if you want to change one of the three input parameters:
26-- showCursor = true, useKeyboard = true and blockJoyStick = false
27-- But don't forget to stick to the naming convention ("GUI_" .. self.filename)
28function P:createInputState()
29    self.inputState = guiMgr:createInputState("GUI_" .. self.filename)
30end
31
32-- hide function for the GUI
33function P:hide()
34    self.window:hide()
35    self.visible = false
36end
37
38-- show function for the GUI
39function P:show()
40    self.window:show()
41    self.visible = true
42end
43
44function P:load()
45    self.window = winMgr:loadWindowLayout(self.filename .. ".layout")
46    self:createInputState()
47    self:init()
48    return self
49end
50
51return P
Note: See TracBrowser for help on using the repository browser.