Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Mar 6, 2011, 4:32:05 PM (13 years ago)
Author:
dafrick
Message:

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…

File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/branches/usability/data/gui/scripts/SheetManager.lua

    r8033 r8035  
    55local activeMenuSheets = {size = 0, topSheetTuple = nil}
    66local menuSheetsRoot = guiMgr:getMenuRootWindow()
    7 local bInGameConsoleClosed = false
    87local mainMenuLoaded = false
    9 orxonox.GUIManager:subscribeEventHelper(menuSheetsRoot, "KeyDown", "keyPressed")
     8--orxonox.GUIManager:subscribeEventHelper(menuSheetsRoot, "KeyDown", "keyPressed")
    109orxonox.GUIManager:subscribeEventHelper(menuSheetsRoot, "Sized", "windowResized")
    1110
     
    132131    if previous and previous.pressedEnter and menuSheet:hasSelection() == false then
    133132        menuSheet:setSelectionNear(1, 1)
     133    end
     134
     135    if activeMenuSheets.size > 0 then
     136        guiMgr:guisActiveChanged(true)
    134137    end
    135138
     
    204207    end
    205208
     209    if activeMenuSheets.size == 0 then
     210        guiMgr:guisActiveChanged(false)
     211    end
     212
    206213    sheetTuple.sheet:quit()
    207214end
     
    217224    -- HUGE, very HUGE hacks!
    218225
    219     -- If the InGameConsole is active, ignore the ESC command.
    220     if bInGameConsoleClosed == true then
    221         bInGameConsoleClosed = false
    222         return
    223     end
    224 
    225     -- Count the number of sheets that don't need input till the first that does.
     226    -- Count the number of sheets that don't need input until the first that does.
    226227    local counter = noInputSheetIndex()
    227228
     
    237238end
    238239
    239 function keyPressed(e)
    240     local we = tolua.cast(e, "CEGUI::KeyEventArgs")
     240-- Function to navigate the GUI, is called by the GUIManager, whenever a relevant key is pressed.
     241-- The mode specifies the action to be taken.
     242function navigateGUI(mode)
    241243    local sheet = activeMenuSheets[activeMenuSheets.size]
    242     code = tostring(we.scancode)
    243     -- Some preprocessing
    244     if not mainMenuLoaded and not sheet.bNoInput then
    245         if code == "1" then
    246             keyESC()
    247         elseif code == "0"then
    248             orxonox.CommandExecutor:execute("InGameConsole openConsole")
    249         end
    250     end
    251     sheet.sheet:keyPressed()
     244    sheet.sheet:keyPressed(mode)
    252245end
    253246
     
    293286    end
    294287    return counter
    295 end
    296 
    297 function inGameConsoleClosed()
    298     bInGameConsoleClosed = not bInGameConsoleClosed;
    299288end
    300289
Note: See TracChangeset for help on using the changeset viewer.