Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Mar 15, 2011, 9:47:11 PM (13 years ago)
Author:
landauf
Message:

merged usability branch back to trunk

incomplete summary of the changes in this branch:

  • enhanced keyboard navigation in GUIs
  • implemented new graphics menu and changeable window size at runtime
  • added developer mode
  • HUD shows if game is paused, game pauses if ingame menu is opened
  • removed a few obsolete commands and hid some that are more for internal use
  • numpad works in console and gui
  • faster loading of level info
  • enhanced usage of compositors (Shader class)
  • improved camera handling, configurable FOV and aspect ratio
Location:
code/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • code/trunk

  • code/trunk/data/gui/scripts/SheetManager.lua

    r7689 r8079  
    88local mainMenuLoaded = false
    99orxonox.GUIManager:subscribeEventHelper(menuSheetsRoot, "KeyDown", "keyPressed")
    10 
    11 -----------------------
    12 --- Local functions ---
    13 -----------------------
    14 
    15 local function hideCursor()
    16     if cursor:isVisible() then
    17         cursor:hide()
    18     end
    19 end
    20 
    21 local function showCursor()
    22     if not cursor:isVisible() and inputMgr:isMouseExclusive() then
    23         cursor:show()
    24     end
    25 end
    26 
     10orxonox.GUIManager:subscribeEventHelper(menuSheetsRoot, "Sized", "windowResized")
    2711
    2812------------------------
    2913--- Global functions ---
    3014------------------------
     15
     16function hideCursor()
     17    if cursor:isVisible() then
     18        cursor:hide()
     19    end
     20end
     21
     22function showCursor()
     23    if not cursor:isVisible() and inputMgr:isMouseExclusive() then
     24        cursor:show()
     25    end
     26end
    3127
    3228-- Loads the GUI with the specified name
     
    9389        ["sheet"]          = menuSheet,
    9490        ["bHidePrevious"]  = bHidePrevious,
    95         ["bNoInput"]       = bNoInput
     91        ["bNoInput"]       = bNoInput,
     92        ["name"]           = name
    9693    }
    9794    table.insert(activeMenuSheets, sheetTuple) -- indexed array access
     
    121118
    122119    -- Hide all previous sheets if necessary
     120    local previous
    123121    if bHidePrevious then
    124122        for i = 1, activeMenuSheets.size - 1 do
    125             activeMenuSheets[i].sheet:hide()
    126         end
    127     end
    128    
     123            previous = activeMenuSheets[i].sheet
     124            previous:hide()
     125        end
     126    end
     127
    129128    menuSheet:show()
    130129    menuSheetsRoot:activate()
     130
     131    -- select first button if the menu was opened with the keyboard
     132    if previous and previous.pressedEnter and menuSheet:hasSelection() == false then
     133        menuSheet:setSelectionNear(1, 1)
     134    end
    131135
    132136    return menuSheet
     
    179183        inputMgr:leaveState(sheetTuple.sheet.inputState)
    180184    end
    181    
     185
    182186    -- CURSOR SHOWING
    183187    local i = activeMenuSheets.size
     
    200204    end
    201205
    202     sheetTuple.sheet:afterHide()
     206    sheetTuple.sheet:quit()
    203207end
    204208
     
    242246            keyESC()
    243247        elseif code == "0"then
    244             orxonox.CommandExecutor:execute("openConsole")
    245         end
    246     end
    247     sheet.sheet:onKeyPressed()
     248            orxonox.CommandExecutor:execute("InGameConsole openConsole")
     249        end
     250    end
     251    sheet.sheet:keyPressed()
     252end
     253
     254function windowResized(e)
     255    for name, sheet in pairs(loadedSheets) do
     256        if orxonox.GraphicsManager:getInstance():isFullScreen() or sheet.tShowCursor == TriBool.False then
     257            inputMgr:setMouseExclusive(sheet.inputState, TriBool.True)
     258        else
     259            inputMgr:setMouseExclusive(sheet.inputState, TriBool.False)
     260        end
     261    end
     262    local sheetTuple = activeMenuSheets[activeMenuSheets.size]
     263    if sheetTuple then
     264        if orxonox.GraphicsManager:getInstance():isFullScreen() and sheetTuple.sheet.tShowCursor ~= TriBool.False then
     265            showCursor()
     266        else
     267            hideCursor()
     268        end
     269        sheetTuple.sheet:windowResized()
     270    end
    248271end
    249272
     
    276299end
    277300
     301function getGUIFirstActive(name, bHidePrevious, bNoInput)
     302    local sheet = activeMenuSheets.topSheetTuple
     303    -- If the topmost gui sheet has the input name
     304    if sheet ~= nil and sheet.name == name then
     305        guiMgr:toggleGUIHelper(name, bHidePrevious, bNoInput, false);
     306    else
     307        guiMgr:toggleGUIHelper(name, bHidePrevious, bNoInput, true);
     308    end
     309end
     310
    278311----------------------
    279312--- Initialisation ---
Note: See TracChangeset for help on using the changeset viewer.