Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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

Last change on this file since 6699 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
RevLine 
[6621]1-- BasicGUI.lua
[5491]2
3local P = {}
[6621]4_G[_REQUIREDNAME or "BasicGUI"] = P
[5491]5
[6537]6-- useless, even wrong? P is the class, not the object..
[5491]7P.overlay = nil
8
9-- constructor of the GUI
[6537]10function P:new(_filename, _gui, _visible)
[6459]11    local newElement = {
12        filename = _filename,
13        gui = _gui,
14        visible = _visible or false
15    } or {}
[5491]16    setmetatable(newElement, self) -- connects new element with class
17    self.__index = self
18    return newElement
19end
20
[6537]21-- Override this function if you need to
[5523]22function P:init()
23end
24
[6621]25-- Override this function if you want to change one of the three input parameters:
26-- showCursor = true, useKeyboard = true and blockJoyStick = false
[6537]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
[5491]32-- hide function for the GUI
[6459]33function P:hide()
[5491]34    self.window:hide()
35    self.visible = false
36end
37
38-- show function for the GUI
[6459]39function P:show()
[5491]40    self.window:show()
41    self.visible = true
42end
43
[6459]44function P:load()
45    self.window = winMgr:loadWindowLayout(self.filename .. ".layout")
[6537]46    self:createInputState()
[5559]47    self:init()
48    return self
[5491]49end
50
[5661]51return P
Note: See TracBrowser for help on using the repository browser.