Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Mar 16, 2010, 1:49:16 PM (15 years ago)
Author:
rgrieder
Message:

Linked every GUI sheet to exactly one InputState.
Also added util/TriBool that has states {true, false, Dontcare}.

Location:
code/branches/gamestate/src/libraries/core/input
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • code/branches/gamestate/src/libraries/core/input/InputManager.cc

    r6422 r6537  
    8787        , oisInputManager_(0)
    8888        , devices_(2)
    89         , mouseMode_(MouseMode::Nonexclusive)
     89        , exclusiveMouse_(TriBool::False)
    9090        , emptyState_(0)
    9191        , calibratorCallbackHandler_(0)
     
    9898
    9999        if (GraphicsManager::getInstance().isFullScreen())
    100             mouseMode_ = MouseMode::Exclusive;
     100            exclusiveMouse_ = TriBool::True;
    101101        this->loadDevices();
    102102
     
    155155        paramList.insert(std::make_pair("w32_keyboard", "DISCL_FOREGROUND"));
    156156        paramList.insert(std::make_pair("w32_mouse", "DISCL_FOREGROUND"));
    157         if (mouseMode_ == MouseMode::Exclusive || GraphicsManager::getInstance().isFullScreen())
     157        if (exclusiveMouse_ == TriBool::True || GraphicsManager::getInstance().isFullScreen())
    158158        {
    159159            // Disable Windows key plus special keys (like play, stop, next, etc.)
     
    168168        paramList.insert(std::make_pair("XAutoRepeatOn", "true"));
    169169
    170         if (mouseMode_ == MouseMode::Exclusive || GraphicsManager::getInstance().isFullScreen())
     170        if (exclusiveMouse_ == TriBool::True || GraphicsManager::getInstance().isFullScreen())
    171171        {
    172172            if (CommandLineParser::getValue("keyboard_no_grab").getBool())
     
    504504
    505505        // Check whether we have to change the mouse mode
    506         MouseMode::Value requestedMode = MouseMode::Dontcare;
     506        TriBool::Value requestedMode = TriBool::Dontcare;
    507507        std::vector<InputState*>& mouseStates = devices_[InputDeviceEnumerator::Mouse]->getStateListRef();
    508508        if (mouseStates.empty())
    509             requestedMode = MouseMode::Nonexclusive;
     509            requestedMode = TriBool::False;
    510510        else
    511             requestedMode = mouseStates.front()->getMouseMode();
    512         if (requestedMode != MouseMode::Dontcare && mouseMode_ != requestedMode)
    513         {
    514             mouseMode_ = requestedMode;
     511            requestedMode = mouseStates.front()->getMouseExclusive();
     512        if (requestedMode != TriBool::Dontcare && exclusiveMouse_ != requestedMode)
     513        {
     514            exclusiveMouse_ = requestedMode;
    515515            if (!GraphicsManager::getInstance().isFullScreen())
    516516                this->reloadInternal();
  • code/branches/gamestate/src/libraries/core/input/InputManager.h

    r6417 r6537  
    3838
    3939#include "util/Singleton.h"
     40#include "util/TriBool.h"
    4041#include "core/WindowEventListener.h"
    4142#include "InputState.h"
     
    159160            - The removal process is being postponed if InputManager::preUpdate() is currently running.
    160161        */
    161         bool destroyState(const std::string& name);
     162        bool destroyState(const std::string& name); // tolua_export
    162163
    163164        //-------------------------------
     
    196197        OIS::InputManager*                  oisInputManager_;      //!< OIS input manager
    197198        std::vector<InputDevice*>           devices_;              //!< List of all input devices (keyboard, mouse, joy sticks)
    198         MouseMode::Value                    mouseMode_;            //!< Currently applied mouse mode
     199        TriBool::Value                      exclusiveMouse_;       //!< Currently applied mouse mode
    199200
    200201        // some internally handled states and handlers
  • code/branches/gamestate/src/libraries/core/input/InputState.cc

    r6417 r6537  
    3737        , bAlwaysGetsInput_(bAlwaysGetsInput)
    3838        , bTransparent_(bTransparent)
    39         , mouseMode_(MouseMode::Dontcare)
     39        , exclusiveMouse_(TriBool::Dontcare)
    4040        , bExpired_(true)
    4141        , handlers_(2)
  • code/branches/gamestate/src/libraries/core/input/InputState.h

    r5929 r6537  
    3737
    3838#include "util/OrxEnum.h"
     39#include "util/TriBool.h"
    3940#include "InputHandler.h"
    4041#include "JoyStickQuantityListener.h"
     
    5657    };
    5758
    58     namespace MouseMode
    59     {
    60         enum Value
    61         {
    62             Exclusive,
    63             Nonexclusive,
    64             Dontcare
    65         };
    66     }
    6759
    6860    /**
     
    7365        that stack and only the top one gets the input events. This is done for
    7466        every device (keyboard, mouse, all joy sticks) separately to allow
    75         for intance keyboard input capturing for the console while you can still
     67        for instance keyboard input capturing for the console while you can still
    7668        steer a ship with the mouse.
    7769        There are two exceptions to this behaviour though:
     
    8375          the state will always receive input as long as it is activated.
    8476        - Note: If you mark an InputState with both parameters on, then it will
    85           not influence ony other InputState at all.
     77          not influence only other InputState at all.
    8678
    8779    @par Priorities
     
    9587    @par Exclusive/Non-Exclusive mouse Mode
    9688        You can select a specific mouse mode that tells whether the application
    97         should have exclusive accessto it or not.
     89        should have exclusive access to it or not.
    9890        When in non-exclusive mode, you can move the mouse out of the window
    9991        like with any other normal window (only for windowed mode!).
     
    130122        void setHandler        (InputHandler* handler);
    131123
    132         void setMouseMode(MouseMode::Value value) { mouseMode_ = value; this->bExpired_ = true; }
    133         MouseMode::Value getMouseMode() const { return mouseMode_; }
     124        void setMouseExclusive(TriBool::Value value) { exclusiveMouse_ = value; this->bExpired_ = true; }
     125        TriBool::Value getMouseExclusive() const { return exclusiveMouse_; }
    134126
    135127        //! Returns the name of the state (which is unique!)
     
    184176        const bool                  bAlwaysGetsInput_;      //!< See class declaration for explanation
    185177        const bool                  bTransparent_;          //!< See class declaration for explanation
    186         MouseMode::Value            mouseMode_;             //!< See class declaration for explanation
     178        TriBool::Value              exclusiveMouse_;        //!< See class declaration for explanation
    187179        int                         priority_;              //!< Current priority (might change)
    188180        bool                        bExpired_;              //!< See hasExpired()
Note: See TracChangeset for help on using the changeset viewer.