[7163] | 1 | -- MenuSheet.lua |
---|
| 2 | -- Base class for all GUI sheets that represent a menu. |
---|
| 3 | -- Inherits itself from GUISheet |
---|
| 4 | |
---|
| 5 | local P = {} -- Local alias, always use it in this file |
---|
| 6 | MenuSheet = P -- Global name |
---|
| 7 | setmetatable(P, require("GUISheet")) -- Inherit from GUISheet |
---|
| 8 | P.__index = P -- Provide class character |
---|
| 9 | |
---|
| 10 | -- Use this function to construct a new MenuSheet. |
---|
| 11 | -- Parameters: |
---|
| 12 | -- Except for _name, you can provide nil. Then the default value will be used. |
---|
[8687] | 13 | -- For _tShowCusor and _tUseKeyboard you can specify tribool(dontcare) if the value doesn't matter at all. Then the value of the underlaying sheet will be used. |
---|
[7163] | 14 | function P.new(_name, _bHidePrevious, _tShowCursor, _tUseKeyboard, _bBlockJoyStick) |
---|
| 15 | local newSheet = GUISheet.new(_name) |
---|
| 16 | newSheet.bHidePrevious = handleDefArg(_bHidePrevious, true) |
---|
[8687] | 17 | newSheet.tShowCursor = handleDefArg(_tShowCusor, tribool(true)) |
---|
| 18 | newSheet.tUseKeyboard = handleDefArg(_tUseKeyboard, tribool(true)) |
---|
[7163] | 19 | newSheet.bBlockJoyStick = handleDefArg(_bBlockJoyStick, false) |
---|
| 20 | |
---|
| 21 | setmetatable(newSheet, P) |
---|
| 22 | return newSheet |
---|
| 23 | end |
---|
| 24 | |
---|
| 25 | function P:load() |
---|
| 26 | -- Create the input state |
---|
| 27 | self.inputState = guiMgr:createInputState("GUI_" .. self.name, |
---|
| 28 | self.tShowCursor, self.tUseKeyboard, self.bBlockJoyStick) |
---|
| 29 | |
---|
| 30 | -- load() of base 'class' |
---|
| 31 | GUISheet.load(self) |
---|
| 32 | |
---|
| 33 | return self |
---|
| 34 | end |
---|
| 35 | |
---|
| 36 | return P |
---|