Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/branches/usability/data/gui/scripts/MenuSheet.lua @ 8043

Last change on this file since 8043 was 8035, checked in by dafrick, 14 years ago

Replacing hard coded keys for the menu navigation with keys specified in the keybindings.ini file (note: You have to delete your keybindings.ini file for it to be regenerated and work correctly).
The upside is, that now we need less hackish, stuff, it's better integrated, toggling of OrxonoxOverlays (e.g. QuestGUI and PickupInventory, among others) is working again. Closing the InGameConsole with ESC no longer requires a workaround to work.
The downside is, that now GUI sheets that require input, e.g. GraphicsMenu or MiscConfigMenu, no longer support menu navigation and ESC doesn't work there. However, I don't know how to work around that, yet. But since all that ESC business is a hack anyway, I'd rather have the hacks there…

  • Property svn:eol-style set to native
File size: 1.3 KB
RevLine 
[7163]1-- MenuSheet.lua
2-- Base class for all GUI sheets that represent a menu.
3-- Inherits itself from GUISheet
4
5local P = {}  -- Local alias, always use it in this file
6MenuSheet = P -- Global name
7setmetatable(P, require("GUISheet")) -- Inherit from GUISheet
8P.__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.
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.
14function P.new(_name, _bHidePrevious, _tShowCursor, _tUseKeyboard, _bBlockJoyStick)
15    local newSheet = GUISheet.new(_name)
16    newSheet.bHidePrevious  = handleDefArg(_bHidePrevious,  true)
17    newSheet.tShowCursor    = handleDefArg(_tShowCusor,     TriBool.True)
[8035]18    newSheet.tUseKeyboard   = handleDefArg(_tUseKeyboard,   TriBool.Dontcare)
[7163]19    newSheet.bBlockJoyStick = handleDefArg(_bBlockJoyStick, false)
20
21    setmetatable(newSheet, P)
22    return newSheet
23end
24
25function 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
34end
35
36return P
Note: See TracBrowser for help on using the repository browser.