Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 8023


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

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

Location:
code/branches/usability
Files:
4 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
  • code/branches/usability/src/libraries/core/input/InputManager.cc

    r7874 r8023  
    641641        state->destroy();
    642642    }
     643
     644    bool InputManager::setMouseExclusive(const std::string& name, TriBool::Value value)
     645    {
     646        if (name == "empty")
     647        {
     648            COUT(2) << "InputManager: Changing the empty state is not allowed!" << std::endl;
     649            return false;
     650        }
     651        std::map<std::string, InputState*>::iterator it = statesByName_.find(name);
     652        if (it != statesByName_.end())
     653        {
     654            it->second->setMouseExclusive(value);
     655            return true;
     656        }
     657        return false;
     658    }
    643659}
  • code/branches/usability/src/libraries/core/input/InputManager.h

    r7874 r8023  
    163163        */
    164164        bool destroyState(const std::string& name); // tolua_export
     165        /**
     166        @brief
     167            Changes the mouse mode of an input state.
     168        @return
     169            True if the call was successful, fals if the name was not found
     170        */
     171        bool setMouseExclusive(const std::string& name, TriBool::Value value); // tolua_export
    165172
    166173        //-------------------------------
Note: See TracChangeset for help on using the changeset viewer.