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