Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/branches/gamestates2/data/gui/scripts/GUISheet.lua @ 6718

Last change on this file since 6718 was 6718, checked in by rgrieder, 16 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
RevLine 
[6718]1-- GUISheet.lua
[5491]2
3local P = {}
[6718]4_G[_REQUIREDNAME or "GUISheet"] = P
5P.__index = P
[5491]6
[6718]7-- Don't use directly --> use HUDSheet.new or MenuSheet.new
8function P.new(_name)
9    local newSheet = { name = _name }
10    setmetatable(newSheet, P)
11    return newSheet
[5491]12end
13
[6718]14-- Override this function if you need to do work on load
15-- TODO: rename to onLoad
[5523]16function P:init()
17end
18
[5491]19-- hide function for the GUI
[6595]20function P:hide()
[5491]21    self.window:hide()
[6718]22    self.bVisible = false
[5491]23end
24
25-- show function for the GUI
[6595]26function P:show()
[5491]27    self.window:show()
[6718]28    self.bVisible = true
[5491]29end
30
[6595]31function P:load()
[6718]32    -- Load the layout that describes the sheet
[6704]33    self.window = winMgr:loadWindowLayout(self.name .. ".layout")
[6718]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
[5559]40    self:init()
41    return self
[5491]42end
43
[5661]44return P
Note: See TracBrowser for help on using the repository browser.