Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Mar 5, 2011, 11:07:39 PM (13 years ago)
Author:
landauf
Message:

update exclusive mouse mode and cursor visibility when changing fullscreen/window mode

Location:
code/branches/usability/data/gui/scripts
Files:
2 edited

Legend:

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

    r8022 r8023  
    337337    -- prompt for confirmation
    338338    openDecisionPopup("Do you want to keep these settings? (Settings will be reverted in 10 seconds if not accepted)", GraphicsMenu.callback_ApplyDecisionPopup)
     339    if checkedFullscreen then
     340        showCursor()
     341    end
    339342end
    340343
  • code/branches/usability/data/gui/scripts/SheetManager.lua

    r8018 r8023  
    1010orxonox.GUIManager:subscribeEventHelper(menuSheetsRoot, "Sized", "windowResized")
    1111
    12 -----------------------
    13 --- Local functions ---
    14 -----------------------
    15 
    16 local function hideCursor()
    17     if cursor:isVisible() then
    18         cursor:hide()
    19     end
    20 end
    21 
    22 local function showCursor()
    23     if not cursor:isVisible() and inputMgr:isMouseExclusive() then
    24         cursor:show()
    25     end
    26 end
    27 
    28 
    2912------------------------
    3013--- Global functions ---
    3114------------------------
     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
    3227
    3328-- Loads the GUI with the specified name
     
    257252
    258253function windowResized(e)
    259     local sheet = activeMenuSheets[activeMenuSheets.size]
    260     if sheet then
    261         sheet.sheet:windowResized()
     254    for name, sheet in pairs(loadedSheets) do
     255        if orxonox.GraphicsManager:getInstance():isFullScreen() or sheet.tShowCursor == TriBool.False then
     256            inputMgr:setMouseExclusive(sheet.inputState, TriBool.True)
     257        else
     258            inputMgr:setMouseExclusive(sheet.inputState, TriBool.False)
     259        end
     260    end
     261    local sheetTuple = activeMenuSheets[activeMenuSheets.size]
     262    if sheetTuple then
     263        if orxonox.GraphicsManager:getInstance():isFullScreen() and sheetTuple.sheet.tShowCursor ~= TriBool.False then
     264            showCursor()
     265        else
     266            hideCursor()
     267        end
     268        sheetTuple.sheet:windowResized()
    262269    end
    263270end
Note: See TracChangeset for help on using the changeset viewer.