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 | |
---|
3 | local P = {} |
---|
4 | _G[_REQUIREDNAME or "BasicGUI"] = P |
---|
5 | |
---|
6 | -- useless, even wrong? P is the class, not the object.. |
---|
7 | P.overlay = nil |
---|
8 | |
---|
9 | -- constructor of the GUI |
---|
10 | function 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 |
---|
19 | end |
---|
20 | |
---|
21 | -- Override this function if you need to |
---|
22 | function P:init() |
---|
23 | end |
---|
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) |
---|
28 | function P:createInputState() |
---|
29 | self.inputState = guiMgr:createInputState("GUI_" .. self.filename) |
---|
30 | end |
---|
31 | |
---|
32 | -- hide function for the GUI |
---|
33 | function P:hide() |
---|
34 | self.window:hide() |
---|
35 | self.visible = false |
---|
36 | end |
---|
37 | |
---|
38 | -- show function for the GUI |
---|
39 | function P:show() |
---|
40 | self.window:show() |
---|
41 | self.visible = true |
---|
42 | end |
---|
43 | |
---|
44 | function P:load() |
---|
45 | self.window = winMgr:loadWindowLayout(self.filename .. ".layout") |
---|
46 | self:createInputState() |
---|
47 | self:init() |
---|
48 | return self |
---|
49 | end |
---|
50 | |
---|
51 | return P |
---|
Note: See
TracBrowser
for help on using the repository browser.