Last change
on this file since 6718 was
6718,
checked in by rgrieder, 14 years ago
|
Moved BasicGUI.lua to GUISheet.lua and derived MenuSheet.lua as well as HUDSheet.lua from it.
Also, to make a new GUI sheet, use either createHUDSheet or createMenuSheet.
Also removed bShowCursor from the showGUI function. This is now always a value directed by the GUI sheet.
|
-
Property svn:eol-style set to
native
|
File size:
945 bytes
|
Line | |
---|
1 | -- GUISheet.lua |
---|
2 | |
---|
3 | local P = {} |
---|
4 | _G[_REQUIREDNAME or "GUISheet"] = P |
---|
5 | P.__index = P |
---|
6 | |
---|
7 | -- Don't use directly --> use HUDSheet.new or MenuSheet.new |
---|
8 | function P.new(_name) |
---|
9 | local newSheet = { name = _name } |
---|
10 | setmetatable(newSheet, P) |
---|
11 | return newSheet |
---|
12 | end |
---|
13 | |
---|
14 | -- Override this function if you need to do work on load |
---|
15 | -- TODO: rename to onLoad |
---|
16 | function P:init() |
---|
17 | end |
---|
18 | |
---|
19 | -- hide function for the GUI |
---|
20 | function P:hide() |
---|
21 | self.window:hide() |
---|
22 | self.bVisible = false |
---|
23 | end |
---|
24 | |
---|
25 | -- show function for the GUI |
---|
26 | function P:show() |
---|
27 | self.window:show() |
---|
28 | self.bVisible = true |
---|
29 | end |
---|
30 | |
---|
31 | function P:load() |
---|
32 | -- Load the layout that describes the sheet |
---|
33 | self.window = winMgr:loadWindowLayout(self.name .. ".layout") |
---|
34 | if self.window == nil then |
---|
35 | error("Could not load layout file for GUI sheet '"..self.name.."'") |
---|
36 | end |
---|
37 | -- Hide it at first |
---|
38 | self:hide() |
---|
39 | -- Allow sheets to do some work upon loading |
---|
40 | self:init() |
---|
41 | return self |
---|
42 | end |
---|
43 | |
---|
44 | return P |
---|
Note: See
TracBrowser
for help on using the repository browser.