Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Jan 17, 2016, 10:29:21 PM (9 years ago)
Author:
landauf
Message:

merged branch cpp11_v3 back to trunk

Location:
code/trunk
Files:
26 edited

Legend:

Unmodified
Added
Removed
  • code/trunk

  • code/trunk/src/libraries/core/input/Button.cc

    r9983 r11071  
    5353    Button::Button()
    5454        : bButtonThresholdUser_(false)
    55         , paramCommandBuffer_(0)
     55        , paramCommandBuffer_(nullptr)
    5656    {
    5757        nCommands_[0]=0;
     
    7575                    delete commands_[j][i];
    7676                delete[] commands_[j];
    77                 commands_[j] = 0;
     77                commands_[j] = nullptr;
    7878                nCommands_[j] = 0;
    7979            }
     
    196196
    197197                    // add command to the buffer if not yet existing
    198                     for (unsigned int iParamCmd = 0; iParamCmd < paramCommandBuffer_->size(); iParamCmd++)
    199                     {
    200                         if ((*paramCommandBuffer_)[iParamCmd]->evaluation_.getConsoleCommand()
     198                    for (BufferedParamCommand* command : *paramCommandBuffer_)
     199                    {
     200                        if (command->evaluation_.getConsoleCommand()
    201201                            == eval.getConsoleCommand())
    202202                        {
    203203                            // already in list
    204                             cmd->paramCommand_ = (*paramCommandBuffer_)[iParamCmd];
     204                            cmd->paramCommand_ = command;
    205205                            break;
    206206                        }
    207207                    }
    208                     if (cmd->paramCommand_ == 0)
     208                    if (cmd->paramCommand_ == nullptr)
    209209                    {
    210210                        cmd->paramCommand_ = new BufferedParamCommand();
     
    239239            }
    240240            else
    241                 commands_[j] = 0;
     241                commands_[j] = nullptr;
    242242        }
    243243    }
  • code/trunk/src/libraries/core/input/HalfAxis.h

    r7859 r11071  
    4949            : relVal_(0.0f)
    5050            , absVal_(0.0f)
    51             , paramCommands_(0)
     51            , paramCommands_(nullptr)
    5252            , nParamCommands_(0)
    5353            , pressed_(false)
     
    5656        using Button::execute;
    5757        bool execute();
    58         bool addParamCommand(ParamCommand* command);
    59         void clear();
     58        virtual bool addParamCommand(ParamCommand* command) override;
     59        virtual void clear() override;
    6060        void reset();
    6161
  • code/trunk/src/libraries/core/input/InputBuffer.cc

    r9667 r11071  
    7575    InputBuffer::~InputBuffer()
    7676    {
    77         for (std::list<BaseInputBufferListenerTuple*>::const_iterator it = this->listeners_.begin();
    78             it != this->listeners_.end(); ++it)
    79             delete *it;
     77        for (BaseInputBufferListenerTuple* listener : this->listeners_)
     78            delete listener;
    8079    }
    8180
     
    110109    void InputBuffer::insert(const std::string& input, bool update)
    111110    {
    112         for (unsigned int i = 0; i < input.size(); ++i)
    113         {
    114             this->insert(input[i], false);
     111        for (const char& inputChar : input)
     112        {
     113            this->insert(inputChar, false);
    115114
    116115            if (update)
    117                 this->updated(input[i], false);
     116                this->updated(inputChar, false);
    118117        }
    119118
     
    170169    void InputBuffer::updated()
    171170    {
    172         for (std::list<BaseInputBufferListenerTuple*>::iterator it = this->listeners_.begin(); it != this->listeners_.end(); ++it)
    173         {
    174             if ((*it)->bListenToAllChanges_)
    175                 (*it)->callFunction();
     171        for (BaseInputBufferListenerTuple* listener : this->listeners_)
     172        {
     173            if (listener->bListenToAllChanges_)
     174                listener->callFunction();
    176175        }
    177176    }
     
    179178    void InputBuffer::updated(const char& update, bool bSingleInput)
    180179    {
    181         for (std::list<BaseInputBufferListenerTuple*>::iterator it = this->listeners_.begin(); it != this->listeners_.end(); ++it)
    182         {
    183             if ((!(*it)->trueKeyFalseChar_) && ((*it)->bListenToAllChanges_ || ((*it)->char_ == update)) && (!(*it)->bOnlySingleInput_ || bSingleInput))
    184                 (*it)->callFunction();
     180        for (BaseInputBufferListenerTuple* listener : this->listeners_)
     181        {
     182            if ((!listener->trueKeyFalseChar_) && (listener->bListenToAllChanges_ || (listener->char_ == update)) && (!listener->bOnlySingleInput_ || bSingleInput))
     183                listener->callFunction();
    185184        }
    186185    }
     
    201200            return;
    202201
    203         for (std::list<BaseInputBufferListenerTuple*>::iterator it = this->listeners_.begin(); it != this->listeners_.end(); ++it)
    204         {
    205             if ((*it)->trueKeyFalseChar_ && ((*it)->key_ == evt.getKeyCode()))
    206                 (*it)->callFunction();
     202        for (BaseInputBufferListenerTuple* listener : this->listeners_)
     203        {
     204            if (listener->trueKeyFalseChar_ && (listener->key_ == evt.getKeyCode()))
     205                listener->callFunction();
    207206        }
    208207
  • code/trunk/src/libraries/core/input/InputBuffer.h

    r9667 r11071  
    4747              trueKeyFalseChar_(trueKeyFalseChar), char_(_char), key_(key)
    4848        { }
    49         virtual ~BaseInputBufferListenerTuple() { }
     49        virtual ~BaseInputBufferListenerTuple() = default;
    5050        virtual void callFunction() = 0;
    5151        bool bListenToAllChanges_;
     
    6565              listener_(listener), function_(function)
    6666        { }
    67         virtual ~InputBufferListenerTuple() { }
    68         void callFunction()
     67        virtual ~InputBufferListenerTuple() = default;
     68        virtual void callFunction() override
    6969        {
    7070            (listener_->*function_)();
     
    165165                { if (this->cursor_ > 0) { --this->cursor_; } }
    166166
    167             void buttonPressed(const KeyEvent& evt);
     167            virtual void buttonPressed(const KeyEvent& evt) override;
    168168
    169169        private:
    170170            bool charIsAllowed(const char& input);
    171171
    172             void buttonHeld   (const KeyEvent& evt);
    173             void processKey   (const KeyEvent& evt);
     172            virtual void buttonHeld (const KeyEvent& evt) override;
     173            void processKey (const KeyEvent& evt);
    174174
    175             void keyboardUpdated(float dt);
     175            virtual void keyboardUpdated(float dt) override;
    176176
    177177            std::string buffer_;
  • code/trunk/src/libraries/core/input/InputCommands.h

    r9978 r11071  
    5757    public:
    5858        BaseCommand() : bFixedKeybindMode_(false) {}
    59         virtual ~BaseCommand() { }
     59        virtual ~BaseCommand() = default;
    6060
    6161        virtual bool execute(float abs = 1.0f, float rel = 1.0f) = 0;
     
    7676    {
    7777    public:
    78         bool execute(float abs = 1.0f, float rel = 1.0f);
    79         CommandEvaluation* getEvaluation();
    80         virtual SimpleCommand* clone() { return new SimpleCommand(*this); }
     78        virtual bool execute(float abs = 1.0f, float rel = 1.0f) override;
     79        virtual CommandEvaluation* getEvaluation() override;
     80        virtual SimpleCommand* clone() override { return new SimpleCommand(*this); }
    8181
    8282        CommandEvaluation evaluation_;
     
    103103    {
    104104    public:
    105         ParamCommand() : scale_(1.0f), paramCommand_(0) { }
    106         bool execute(float abs = 1.0f, float rel = 1.0f);
    107         CommandEvaluation* getEvaluation();
    108         virtual ParamCommand* clone() { return new ParamCommand(*this); }
     105        ParamCommand() : scale_(1.0f), paramCommand_(nullptr) { }
     106        virtual bool execute(float abs = 1.0f, float rel = 1.0f) override;
     107        virtual CommandEvaluation* getEvaluation() override;
     108        virtual ParamCommand* clone() override { return new ParamCommand(*this); }
    109109
    110110        float scale_;
     
    118118            return &this->paramCommand_->evaluation_;
    119119        else
    120             return 0;
     120            return nullptr;
    121121    }
    122122}
  • code/trunk/src/libraries/core/input/InputDevice.h

    r8858 r11071  
    6060        //! Only resets the members
    6161        InputDevice(unsigned int id) : bCalibrating_(false), deviceID_(id) { }
    62         virtual ~InputDevice() { }
     62        virtual ~InputDevice() = default;
    6363        //! Returns the device class (derived) name as string
    6464        virtual std::string getClassName() const = 0;
     
    9999
    100100    private:
    101         InputDevice(const InputDevice& rhs); //!< Don't use!
     101        // non-copyable:
     102        InputDevice(const InputDevice&) = delete;
     103        InputDevice& operator=(const InputDevice&) = delete;
    102104
    103105        bool bCalibrating_;                  //!< Whether the device is in calibration mode
     
    153155
    154156        //! Captures OIS events (which then get distributed to the derived class) and creates the button held events
    155         void update(const Clock& time)
     157        virtual void update(const Clock& time) override
    156158        {
    157159            oisDevice_->capture();
    158160
    159161            // Call all the states with the held button event
    160             for (unsigned int iB = 0; iB < pressedButtons_.size(); ++iB)
    161                 for (unsigned int iS = 0; iS < inputStates_.size(); ++iS)
    162                     inputStates_[iS]->buttonEvent<ButtonEvent::THold, typename Traits::ButtonTypeParam>(
    163                         this->getDeviceID(), static_cast<DeviceClass*>(this)->getButtonEventArg(pressedButtons_[iB]));
     162            for (ButtonType& button : pressedButtons_)
     163                for (InputState* state : inputStates_)
     164                    state->template buttonEvent<ButtonEvent::THold, typename Traits::ButtonTypeParam>(
     165                        this->getDeviceID(), static_cast<DeviceClass*>(this)->getButtonEventArg(button));
    164166
    165167            // Call states with device update events
    166             for (unsigned int i = 0; i < inputStates_.size(); ++i)
    167                 inputStates_[i]->update(time.getDeltaTime(), this->getDeviceID());
     168            for (InputState* state : inputStates_)
     169                state->update(time.getDeltaTime(), this->getDeviceID());
    168170
    169171            static_cast<DeviceClass*>(this)->updateImpl(time);
     
    171173
    172174        //! Clears the list of pressed buttons and calls the derived class's method
    173         void clearBuffers()
     175        virtual void clearBuffers() override
    174176        {
    175177            pressedButtons_.clear();
     
    180182        OISDeviceClass* getOISDevice()   { return this->oisDevice_; }
    181183        // Returns the name of the derived class as string
    182         std::string getClassName() const { return DeviceClass::getClassNameImpl(); }
     184        virtual std::string getClassName() const override { return DeviceClass::getClassNameImpl(); }
    183185
    184186    protected:
     
    196198
    197199            // Call states
    198             for (unsigned int i = 0; i < inputStates_.size(); ++i)
    199                 inputStates_[i]->buttonEvent<ButtonEvent::TPress, typename Traits::ButtonTypeParam>(this->getDeviceID(), static_cast<DeviceClass*>(this)->getButtonEventArg(button));
     200            for (InputState* state : inputStates_)
     201                state->template buttonEvent<ButtonEvent::TPress, typename Traits::ButtonTypeParam>(this->getDeviceID(), static_cast<DeviceClass*>(this)->getButtonEventArg(button));
    200202        }
    201203
     
    218220
    219221            // Call states
    220             for (unsigned int i = 0; i < inputStates_.size(); ++i)
    221                 inputStates_[i]->buttonEvent<ButtonEvent::TRelease, typename Traits::ButtonTypeParam>(this->getDeviceID(), static_cast<DeviceClass*>(this)->getButtonEventArg(button));
     222            for (InputState* state : inputStates_)
     223                state->template buttonEvent<ButtonEvent::TRelease, typename Traits::ButtonTypeParam>(this->getDeviceID(), static_cast<DeviceClass*>(this)->getButtonEventArg(button));
    222224        }
    223225
  • code/trunk/src/libraries/core/input/InputHandler.h

    r8729 r11071  
    119119    {
    120120    public:
    121         virtual ~InputHandler() { }
     121        virtual ~InputHandler() = default;
    122122
    123123        template<class T> void buttonEvent(unsigned int device, T button, ButtonEvent::TPress)
  • code/trunk/src/libraries/core/input/InputManager.cc

    r10624 r11071  
    3939#include <ois/OISException.h>
    4040#include <ois/OISInputManager.h>
    41 #include <boost/foreach.hpp>
    4241#include <loki/ScopeGuard.h>
    4342
     
    7271    InputHandler InputHandler::EMPTY;
    7372
    74     InputManager* InputManager::singletonPtr_s = 0;
     73    InputManager* InputManager::singletonPtr_s = nullptr;
    7574
    7675    //! Defines the |= operator for easier use.
     
    9493    InputManager::InputManager()
    9594        : internalState_(Bad)
    96         , oisInputManager_(0)
     95        , oisInputManager_(nullptr)
    9796        , devices_(2)
    9897        , exclusiveMouse_(false)
    99         , emptyState_(0)
    100         , calibratorCallbackHandler_(0)
     98        , emptyState_(nullptr)
     99        , calibratorCallbackHandler_(nullptr)
    101100    {
    102101        RegisterObject(InputManager);
     
    149148        // When loading the devices they should not already be loaded
    150149        assert(internalState_ & Bad);
    151         assert(devices_[InputDeviceEnumerator::Mouse] == 0);
    152         assert(devices_[InputDeviceEnumerator::Keyboard] == 0);
     150        assert(devices_[InputDeviceEnumerator::Mouse] == nullptr);
     151        assert(devices_[InputDeviceEnumerator::Keyboard] == nullptr);
    153152        assert(devices_.size() == InputDeviceEnumerator::FirstJoyStick);
    154153
     
    210209        catch (const std::exception& ex)
    211210        {
    212             oisInputManager_ = NULL;
     211            oisInputManager_ = nullptr;
    213212            internalState_ |= Bad;
    214213            ThrowException(InitialisationFailed, "Could not initialise the input system: " << ex.what());
     
    294293
    295294        // Reset console commands
    296         ModifyConsoleCommand(__CC_InputManager_name, __CC_calibrate_name).setObject(0);
    297         ModifyConsoleCommand(__CC_InputManager_name, __CC_reload_name).setObject(0);
     295        ModifyConsoleCommand(__CC_InputManager_name, __CC_calibrate_name).setObject(nullptr);
     296        ModifyConsoleCommand(__CC_InputManager_name, __CC_reload_name).setObject(nullptr);
    298297
    299298        orxout(internal_status, context::input) << "InputManager: Destruction complete." << endl;
     
    310309        orxout(verbose, context::input) << "InputManager: Destroying devices..." << endl;
    311310
    312         BOOST_FOREACH(InputDevice*& device, devices_)
    313         {
    314             if (device == NULL)
     311        for (InputDevice*& device : devices_)
     312        {
     313            if (device == nullptr)
    315314                continue;
    316315            const std::string& className = device->getClassName();
    317316            delete device;
    318             device = 0;
     317            device = nullptr;
    319318            orxout(verbose, context::input) << className << " destroyed." << endl;
    320319        }
    321320        devices_.resize(InputDeviceEnumerator::FirstJoyStick);
    322321
    323         assert(oisInputManager_ != NULL);
     322        assert(oisInputManager_ != nullptr);
    324323        try
    325324        {
     
    331330                                                   << "Potential resource leak!" << endl;
    332331        }
    333         oisInputManager_ = NULL;
     332        oisInputManager_ = nullptr;
    334333
    335334        internalState_ |= Bad;
     
    374373        // check whether a state has changed its EMPTY situation
    375374        bool bUpdateRequired = false;
    376         for (std::map<int, InputState*>::iterator it = activeStates_.begin(); it != activeStates_.end(); ++it)
    377         {
    378             if (it->second->hasExpired())
    379             {
    380                 it->second->resetExpiration();
     375        for (const auto& mapEntry : activeStates_)
     376        {
     377            if (mapEntry.second->hasExpired())
     378            {
     379                mapEntry.second->resetExpiration();
    381380                bUpdateRequired = true;
    382381            }
     
    387386        // Capture all the input and collect the function calls
    388387        // No event gets triggered here yet!
    389         BOOST_FOREACH(InputDevice* device, devices_)
    390             if (device != NULL)
     388        for  (InputDevice* device : devices_)
     389            if (device != nullptr)
    391390                device->update(time);
    392391
    393392        // Collect function calls for the update
    394         for (unsigned int i = 0; i < activeStatesTicked_.size(); ++i)
    395             activeStatesTicked_[i]->update(time.getDeltaTime());
     393        for (InputState* state : activeStatesTicked_)
     394            state->update(time.getDeltaTime());
    396395
    397396        // Execute all cached function calls in order
     
    402401        // If we delay the calls, then OIS and and the InputStates are not anymore
    403402        // in the call stack and can therefore be edited.
    404         for (size_t i = 0; i < this->callBuffer_.size(); ++i)
    405             this->callBuffer_[i]();
     403        for (auto& function : this->callBuffer_)
     404            function();
    406405
    407406        this->callBuffer_.clear();
     
    419418        for (unsigned int i = 0; i < devices_.size(); ++i)
    420419        {
    421             if (devices_[i] == NULL)
     420            if (devices_[i] == nullptr)
    422421                continue;
    423422            std::vector<InputState*>& states = devices_[i]->getStateListRef();
     
    438437        // Using an std::set to avoid duplicates
    439438        std::set<InputState*> tempSet;
    440         for (unsigned int i = 0; i < devices_.size(); ++i)
    441             if (devices_[i] != NULL)
    442                 for (unsigned int iState = 0; iState < devices_[i]->getStateListRef().size(); ++iState)
    443                     tempSet.insert(devices_[i]->getStateListRef()[iState]);
     439        for (InputDevice* device : devices_)
     440            if (device != nullptr)
     441                for (unsigned int iState = 0; iState < device->getStateListRef().size(); ++iState)
     442                    tempSet.insert(device->getStateListRef()[iState]);
    444443
    445444        // Copy the content of the std::set back to the actual vector
    446445        activeStatesTicked_.clear();
    447         for (std::set<InputState*>::const_iterator it = tempSet.begin();it != tempSet.end(); ++it)
    448             activeStatesTicked_.push_back(*it);
     446        for (InputState* state : tempSet)
     447            activeStatesTicked_.push_back(state);
    449448
    450449        // Check whether we have to change the mouse mode
     
    466465    void InputManager::clearBuffers()
    467466    {
    468         BOOST_FOREACH(InputDevice* device, devices_)
    469             if (device != NULL)
     467        for (InputDevice* device : devices_)
     468            if (device != nullptr)
    470469                device->clearBuffers();
    471470    }
     
    476475                        << "When done, put the axex in the middle position and press enter." << endl;
    477476
    478         BOOST_FOREACH(InputDevice* device, devices_)
    479             if (device != NULL)
     477        for (InputDevice* device : devices_)
     478            if (device != nullptr)
    480479                device->startCalibration();
    481480
     
    487486    void InputManager::stopCalibration()
    488487    {
    489         BOOST_FOREACH(InputDevice* device, devices_)
    490             if (device != NULL)
     488        for (InputDevice* device : devices_)
     489            if (device != nullptr)
    491490                device->stopCalibration();
    492491
     
    509508    {
    510509        Mouse* mouse = static_cast<Mouse*>(devices_[InputDeviceEnumerator::Mouse]);
    511         if (mouse != NULL)
     510        if (mouse != nullptr)
    512511        {
    513512            const OIS::MouseState state = mouse->getOISDevice()->getMouseState();
     
    526525    {
    527526        if (name.empty())
    528             return 0;
     527            return nullptr;
    529528        if (statesByName_.find(name) == statesByName_.end())
    530529        {
     
    532531            {
    533532                // Make sure we don't add two high priority states with the same priority
    534                 for (std::map<std::string, InputState*>::const_iterator it = this->statesByName_.begin();
    535                     it != this->statesByName_.end(); ++it)
     533                for (const auto& mapEntry : this->statesByName_)
    536534                {
    537                     if (it->second->getPriority() == priority)
     535                    if (mapEntry.second->getPriority() == priority)
    538536                    {
    539537                        orxout(internal_warning, context::input) << "Could not add an InputState with the same priority '"
    540538                            << static_cast<int>(priority) << "' != 0." << endl;
    541                         return 0;
     539                        return nullptr;
    542540                    }
    543541                }
     
    551549        {
    552550            orxout(internal_warning, context::input) << "Could not add an InputState with the same name '" << name << "'." << endl;
    553             return 0;
     551            return nullptr;
    554552        }
    555553    }
     
    561559            return it->second;
    562560        else
    563             return 0;
     561            return nullptr;
    564562    }
    565563
  • code/trunk/src/libraries/core/input/InputManager.h

    r8729 r11071  
    3535#include <string>
    3636#include <vector>
    37 #include <boost/function.hpp>
     37#include <functional>
    3838
    3939#include "util/Singleton.h"
     
    134134            Returns a pointer to a InputState referenced by name.
    135135        @return
    136             Returns NULL if state was not found.
     136            Returns nullptr if state was not found.
    137137        */
    138138        InputState* getState(const std::string& name);
     
    186186        // Function call caching
    187187        //-------------------------------
    188         void pushCall(const boost::function<void ()>& function)
     188        void pushCall(const std::function<void ()>& function)
    189189            { this->callBuffer_.push_back(function); }
    190190
     
    192192
    193193    private: // functions
    194         // don't mess with a Singleton
    195         InputManager(const InputManager&);
     194        // non-copyable:
     195        InputManager(const InputManager&) = delete;
     196        InputManager& operator=(const InputManager&) = delete;
    196197
    197198        // Internal methods
     
    208209
    209210        // From WindowEventListener
    210         void windowFocusChanged(bool bFocus);
     211        virtual void windowFocusChanged(bool bFocus) override;
    211212
    212213    private: // variables
     
    225226        std::vector<InputState*>            activeStatesTicked_;   //!< Like activeStates_, but only contains the ones that currently receive events
    226227
    227         std::vector<boost::function<void ()> > callBuffer_;        //!< Caches all calls from InputStates to be executed afterwards (see preUpdate)
     228        std::vector<std::function<void ()>> callBuffer_;        //!< Caches all calls from InputStates to be executed afterwards (see preUpdate)
    228229
    229230        static InputManager*                singletonPtr_s;        //!< Pointer reference to the singleton
  • code/trunk/src/libraries/core/input/InputPrereqs.h

    r8729 r11071  
    454454        OrxEnumConstructors(InputStatePriority);
    455455
    456         static const int Empty        = -1;
    457         static const int Dynamic      = 0;
    458 
    459         static const int HighPriority = 1000;
    460         static const int Console      = HighPriority + 0;
    461         static const int Calibrator   = HighPriority + 1;
    462         static const int Detector     = HighPriority + 2;
     456        static constexpr int Empty        = -1;
     457        static constexpr int Dynamic      = 0;
     458
     459        static constexpr int HighPriority = 1000;
     460        static constexpr int Console      = HighPriority + 0;
     461        static constexpr int Calibrator   = HighPriority + 1;
     462        static constexpr int Detector     = HighPriority + 2;
    463463    };
    464464}
  • code/trunk/src/libraries/core/input/InputState.cc

    r8729 r11071  
    4040        , bExpired_(true)
    4141        , handlers_(2)
    42         , joyStickHandlerAll_(0)
    43         , enterFunctor_(0)
    44         , leaveFunctor_(0)
     42        , joyStickHandlerAll_(nullptr)
     43        , enterFunctor_(nullptr)
     44        , leaveFunctor_(nullptr)
    4545    {
    4646        if (priority >= InputStatePriority::HighPriority || priority == InputStatePriority::Empty)
     
    4949            priority_ = 0;
    5050
    51         handlers_.resize(InputDeviceEnumerator::FirstJoyStick + this->getJoyStickList().size(), NULL);
     51        handlers_.resize(InputDeviceEnumerator::FirstJoyStick + this->getJoyStickList().size(), nullptr);
    5252    }
    5353
     
    5555    {
    5656        if (device < handlers_.size())
    57             return handlers_[device] != NULL;
     57            return handlers_[device] != nullptr;
    5858        else
    5959            return false;
     
    6464    {
    6565        unsigned int oldSize = handlers_.size();
    66         handlers_.resize(InputDeviceEnumerator::FirstJoyStick + joyStickList.size(), NULL);
     66        handlers_.resize(InputDeviceEnumerator::FirstJoyStick + joyStickList.size(), nullptr);
    6767
    6868        for (unsigned int i = oldSize; i < handlers_.size(); ++i)
  • code/trunk/src/libraries/core/input/InputState.h

    r8729 r11071  
    3535#include <string>
    3636#include <vector>
    37 #include <boost/function.hpp>
    38 #include <boost/bind.hpp>
     37#include <functional>
    3938
    4039#include "util/tribool.h"
     
    4443
    4544#define INPUT_STATE_PUSH_CALL(deviceIndex, functionName, ...) \
    46     InputManager::getInstance().pushCall(boost::function<void ()>(boost::bind(&InputHandler::functionName, handlers_[deviceIndex], __VA_ARGS__)))
     45    InputManager::getInstance().pushCall(std::function<void ()>(std::bind(&InputHandler::functionName, handlers_[deviceIndex], __VA_ARGS__)))
    4746
    4847namespace orxonox
     
    156155    private:
    157156        InputState(const std::string& name, bool bAlwaysGetsInput, bool bTransparent, InputStatePriority priority);
    158         ~InputState() { }
    159 
    160         void JoyStickQuantityChanged(const std::vector<JoyStick*>& joyStickList);
     157        ~InputState() = default;
     158
     159        virtual void JoyStickQuantityChanged(const std::vector<JoyStick*>& joyStickList) override;
    161160
    162161        //! Sets the priority (only to be used by the InputManager!)
     
    179178    {
    180179        for (unsigned int i = 0; i < handlers_.size(); ++i)
    181             if (handlers_[i] != NULL)
     180            if (handlers_[i] != nullptr)
    182181                INPUT_STATE_PUSH_CALL(i, allDevicesUpdated, dt);
    183182    }
     
    188187        {
    189188        case InputDeviceEnumerator::Keyboard:
    190             if (handlers_[keyboardIndex_s] != NULL)
     189            if (handlers_[keyboardIndex_s] != nullptr)
    191190                INPUT_STATE_PUSH_CALL(keyboardIndex_s, keyboardUpdated, dt);
    192191            break;
    193192
    194193        case InputDeviceEnumerator::Mouse:
    195             if (handlers_[mouseIndex_s] != NULL)
     194            if (handlers_[mouseIndex_s] != nullptr)
    196195                INPUT_STATE_PUSH_CALL(mouseIndex_s, mouseUpdated, dt);
    197196            break;
    198197
    199198        default: // joy sticks
    200             if (handlers_[device] != NULL)
     199            if (handlers_[device] != nullptr)
    201200                INPUT_STATE_PUSH_CALL(device, joyStickUpdated, device - firstJoyStickIndex_s, dt);
    202201            break;
     
    208207    {
    209208        assert(device < handlers_.size());
    210         if (handlers_[device] != NULL)
     209        if (handlers_[device] != nullptr)
    211210        {
    212211            // We have to store the function pointer to tell the compiler about its actual type because of overloading
    213212            void (InputHandler::*function)(unsigned int, ButtonTypeParam, EventType) = &InputHandler::buttonEvent<ButtonTypeParam>;
    214             InputManager::getInstance().pushCall(boost::function<void ()>(boost::bind(function, handlers_[device], device, button, EventType())));
     213            InputManager::getInstance().pushCall(std::function<void ()>(std::bind(function, handlers_[device], device, button, EventType())));
    215214        }
    216215    }
     
    218217    ORX_FORCEINLINE void InputState::mouseMoved(IntVector2 abs, IntVector2 rel, IntVector2 clippingSize)
    219218    {
    220         if (handlers_[mouseIndex_s] != NULL)
     219        if (handlers_[mouseIndex_s] != nullptr)
    221220            INPUT_STATE_PUSH_CALL(mouseIndex_s, mouseMoved, abs, rel, clippingSize);
    222221    }
     
    224223    ORX_FORCEINLINE void InputState::mouseScrolled(int abs, int rel)
    225224    {
    226         if (handlers_[mouseIndex_s] != NULL)
     225        if (handlers_[mouseIndex_s] != nullptr)
    227226            INPUT_STATE_PUSH_CALL(mouseIndex_s, mouseScrolled, abs, rel);
    228227    }
     
    231230    {
    232231        assert(device < handlers_.size());
    233         if (handlers_[device] != NULL)
     232        if (handlers_[device] != nullptr)
    234233            INPUT_STATE_PUSH_CALL(device, axisMoved, device - firstJoyStickIndex_s, axis, value);
    235234    }
  • code/trunk/src/libraries/core/input/JoyStick.cc

    r10624 r11071  
    3131#include <climits>
    3232#include <ois/OISJoyStick.h>
    33 #include <boost/foreach.hpp>
    3433
    3534#include "util/StringUtils.h"
     
    7372        //deviceName_ += multi_cast<std::string>(oisDevice_->getNumberOfComponents(OIS::OIS_Vector3));
    7473
    75         BOOST_FOREACH(std::string& idString, deviceNames_s)
     74        for (const std::string& idString : deviceNames_s)
    7675        {
    7776            if (deviceName_ == idString)
     
    128127    {
    129128        // Set initial values
    130         BOOST_FOREACH(int& minVal, configMinValues_)
     129        for (int& minVal : configMinValues_)
    131130            minVal = INT_MAX;
    132         BOOST_FOREACH(int& minVal, configMaxValues_)
     131        for (int& minVal : configMaxValues_)
    133132            minVal = INT_MIN;
    134         BOOST_FOREACH(int& zeroVal, configZeroValues_)
     133        for (int& zeroVal : configZeroValues_)
    135134            zeroVal = 0;
    136135    }
     
    187186    void JoyStick::clearBuffersImpl()
    188187    {
    189         for (int j = 0; j < 4; ++j)
    190             povStates_[j] = 0;
     188        for (int& state : povStates_)
     189            state = 0;
    191190    }
    192191
     
    209208                fValue *= negativeCoeffs_[axis];
    210209
    211             BOOST_FOREACH(InputState* state, inputStates_)
     210            for (InputState* state : inputStates_)
    212211                state->joyStickAxisMoved(this->getDeviceID(), axis, fValue);
    213212        }
  • code/trunk/src/libraries/core/input/JoyStick.h

    r9667 r11071  
    7070        //! Assigns a generated ID string and loads the calibration (if present)
    7171        JoyStick(unsigned int id, OIS::InputManager* oisInputManager);
    72         ~JoyStick() { }
     72        ~JoyStick() = default;
    7373        void setConfigValues();
    7474
     
    7777
    7878    private:
    79         void calibrationStarted();
    80         void calibrationStopped();
     79        virtual void calibrationStarted() override;
     80        virtual void calibrationStopped() override;
    8181        void evaluateCalibration();
    8282
     
    8686
    8787        //! OIS event handler
    88         bool buttonPressed (const OIS::JoyStickEvent &arg, int button)
     88        virtual bool buttonPressed (const OIS::JoyStickEvent &arg, int button) override
    8989        {
    9090            super::buttonPressed(static_cast<JoyStickButtonCode::ByEnum>(button));
     
    9393
    9494        //! OIS event handler
    95         bool buttonReleased(const OIS::JoyStickEvent &arg, int button)
     95        virtual bool buttonReleased(const OIS::JoyStickEvent &arg, int button) override
    9696        {
    9797            super::buttonReleased(static_cast<JoyStickButtonCode::ByEnum>(button));
     
    9999        }
    100100
    101         bool axisMoved     (const OIS::JoyStickEvent &arg, int axis);
    102         bool sliderMoved   (const OIS::JoyStickEvent &arg, int id);
    103         bool povMoved      (const OIS::JoyStickEvent &arg, int id);
     101        virtual bool axisMoved     (const OIS::JoyStickEvent &arg, int axis) override;
     102        virtual bool sliderMoved   (const OIS::JoyStickEvent &arg, int id) override;
     103        virtual bool povMoved      (const OIS::JoyStickEvent &arg, int id) override;
    104104        //! OIS event handler (don't remove that because of OIS version issues!)
    105         bool vector3Moved  (const OIS::JoyStickEvent &arg, int id) { return true; }
     105        virtual bool vector3Moved  (const OIS::JoyStickEvent &arg, int id) override { return true; }
    106106
    107107        //! Returns the class name as string
  • code/trunk/src/libraries/core/input/JoyStickQuantityListener.cc

    r10624 r11071  
    4747    {
    4848        joyStickList_s = joyStickList;
    49         for (ObjectList<JoyStickQuantityListener>::iterator it = ObjectList<JoyStickQuantityListener>::begin(); it; ++it)
    50             it->JoyStickQuantityChanged(joyStickList);
     49        for (JoyStickQuantityListener* listener : ObjectList<JoyStickQuantityListener>())
     50            listener->JoyStickQuantityChanged(joyStickList);
    5151    }
    5252}
  • code/trunk/src/libraries/core/input/JoyStickQuantityListener.h

    r9667 r11071  
    4848    protected:
    4949        JoyStickQuantityListener();
    50         virtual ~JoyStickQuantityListener() { }
     50        virtual ~JoyStickQuantityListener() = default;
    5151
    5252        //! Returns a list with all JoySticks currently loaded
  • code/trunk/src/libraries/core/input/KeyBinder.cc

    r11052 r11071  
    5353        : deriveTime_(0.0f)
    5454        , filename_(filename)
    55         , configFile_(NULL)
    56         , fallbackConfigFile_(NULL)
     55        , configFile_(nullptr)
     56        , fallbackConfigFile_(nullptr)
    5757    {
    5858        mouseRelative_[0] = 0;
     
    153153    void KeyBinder::buttonThresholdChanged()
    154154    {
    155         for (unsigned int i = 0; i < allHalfAxes_.size(); i++)
    156             if (!allHalfAxes_[i]->bButtonThresholdUser_)
    157                 allHalfAxes_[i]->buttonThreshold_ = this->buttonThreshold_;
     155        for (HalfAxis* halfAxis : allHalfAxes_)
     156            if (!halfAxis->bButtonThresholdUser_)
     157                halfAxis->buttonThreshold_ = this->buttonThreshold_;
    158158    }
    159159
     
    170170
    171171        // load the bindings if required
    172         if (configFile_ != NULL)
     172        if (configFile_ != nullptr)
    173173        {
    174174            for (unsigned int iDev = oldValue; iDev < joySticks_.size(); ++iDev)
     
    188188    {
    189189        while (joyStickAxes_.size() < joySticks_.size())
    190             joyStickAxes_.push_back(shared_ptr<JoyStickAxisVector>(new JoyStickAxisVector()));
     190            joyStickAxes_.push_back(std::make_shared<JoyStickAxisVector>());
    191191        while (joyStickButtons_.size() < joySticks_.size())
    192             joyStickButtons_.push_back(shared_ptr<JoyStickButtonVector>(new JoyStickButtonVector()));
     192            joyStickButtons_.push_back(std::make_shared<JoyStickButtonVector>());
    193193        // For the case the new size is smaller
    194194        this->joyStickAxes_.resize(joySticks_.size());
     
    274274
    275275        // Parse bindings and create the ConfigValueContainers if necessary
    276         for (std::map<std::string, Button*>::const_iterator it = allButtons_.begin(); it != allButtons_.end(); ++it)
    277         {
    278             it->second->readBinding(this->configFile_, this->fallbackConfigFile_);
    279             addButtonToCommand(it->second->bindingString_, it->second);
     276        for (const auto& mapEntry : allButtons_)
     277        {
     278            mapEntry.second->readBinding(this->configFile_, this->fallbackConfigFile_);
     279            addButtonToCommand(mapEntry.second->bindingString_, mapEntry.second);
    280280        }
    281281
     
    420420    void KeyBinder::clearBindings()
    421421    {
    422         for (std::map<std::string, Button*>::const_iterator it = allButtons_.begin(); it != allButtons_.end(); ++it)
    423             it->second->clear();
    424 
    425         for (unsigned int i = 0; i < paramCommandBuffer_.size(); i++)
    426             delete paramCommandBuffer_[i];
     422        for (const auto& mapEntry : allButtons_)
     423            mapEntry.second->clear();
     424
     425        for (BufferedParamCommand* command : paramCommandBuffer_)
     426            delete command;
    427427        paramCommandBuffer_.clear();
    428428    }
     
    434434    {
    435435        // iterate over all buttons
    436         for (std::map<std::string, Button*>::iterator it = this->allButtons_.begin(); it != this->allButtons_.end(); ++it)
    437         {
    438             Button* button = it->second;
     436        for (const auto& mapEntry : this->allButtons_)
     437        {
     438            Button* button = mapEntry.second;
    439439
    440440            // iterate over all modes
     
    479479                        {
    480480                            delete[] button->commands_[mode_index];
    481                             button->commands_[mode_index] = 0;
     481                            button->commands_[mode_index] = nullptr;
    482482                        }
    483483
     
    505505        this->mousePosition_[1] = 0.0f;
    506506
    507         for (unsigned int i = 0; i < MouseAxisCode::numberOfAxes * 2; i++)
    508             mouseAxes_[i].reset();
     507        for (HalfAxis& axis : mouseAxes_)
     508            axis.reset();
    509509    }
    510510
     
    545545        }
    546546
    547         for (unsigned int i = 0; i < MouseAxisCode::numberOfAxes * 2; i++)
     547        for (HalfAxis& axis : mouseAxes_)
    548548        {
    549549            // Why dividing relative value by dt? The reason lies in the simple fact, that when you
     
    555555            {
    556556                // just ignore if dt == 0.0 because we have multiplied by 0.0 anyway..
    557                 mouseAxes_[i].relVal_ /= dt;
    558             }
    559 
    560             tickHalfAxis(mouseAxes_[i]);
     557                axis.relVal_ /= dt;
     558            }
     559
     560            tickHalfAxis(axis);
    561561        }
    562562    }
  • code/trunk/src/libraries/core/input/KeyBinder.h

    r11052 r11071  
    3636#include <vector>
    3737#include <map>
    38 #include <boost/shared_ptr.hpp>
     38#include <memory>
    3939
    4040#include "InputHandler.h"
     
    8585        void compilePointerLists();
    8686        // from JoyStickQuantityListener interface
    87         virtual void JoyStickQuantityChanged(const std::vector<JoyStick*>& joyStickList);
    88 
    89         void allDevicesUpdated(float dt);
    90         void mouseUpdated(float dt);
    91         void joyStickUpdated(unsigned int joyStick, float dt);
     87        virtual void JoyStickQuantityChanged(const std::vector<JoyStick*>& joyStickList) override;
     88
     89        virtual void allDevicesUpdated(float dt) override;
     90        virtual void mouseUpdated(float dt) override;
     91        virtual void joyStickUpdated(unsigned int joyStick, float dt) override;
    9292        // internal
    9393        void tickHalfAxis(HalfAxis& halfAxis);
    9494
    95         void buttonPressed (const KeyEvent& evt);
    96         void buttonReleased(const KeyEvent& evt);
    97         void buttonHeld    (const KeyEvent& evt);
    98 
    99         void buttonPressed (MouseButtonCode::ByEnum button);
    100         void buttonReleased(MouseButtonCode::ByEnum button);
    101         void buttonHeld    (MouseButtonCode::ByEnum button);
    102         void mouseMoved    (IntVector2 abs, IntVector2 rel, IntVector2 clippingSize);
    103         void mouseScrolled (int abs, int rel);
    104 
    105         void buttonPressed (unsigned int device, JoyStickButtonCode::ByEnum button);
    106         void buttonReleased(unsigned int device, JoyStickButtonCode::ByEnum button);
    107         void buttonHeld    (unsigned int device, JoyStickButtonCode::ByEnum button);
    108         void axisMoved     (unsigned int device, unsigned int axis, float value);
     95        virtual void buttonPressed (const KeyEvent& evt) override;
     96        virtual void buttonReleased(const KeyEvent& evt) override;
     97        virtual void buttonHeld    (const KeyEvent& evt) override;
     98
     99        virtual void buttonPressed (MouseButtonCode::ByEnum button) override;
     100        virtual void buttonReleased(MouseButtonCode::ByEnum button) override;
     101        virtual void buttonHeld    (MouseButtonCode::ByEnum button) override;
     102        virtual void mouseMoved    (IntVector2 abs, IntVector2 rel, IntVector2 clippingSize) override;
     103        virtual void mouseScrolled (int abs, int rel) override;
     104
     105        virtual void buttonPressed (unsigned int device, JoyStickButtonCode::ByEnum button) override;
     106        virtual void buttonReleased(unsigned int device, JoyStickButtonCode::ByEnum button) override;
     107        virtual void buttonHeld    (unsigned int device, JoyStickButtonCode::ByEnum button) override;
     108        virtual void axisMoved     (unsigned int device, unsigned int axis, float value) override;
    109109
    110110    protected: // variables
     
    128128        };
    129129        //! Actual key bindings for joy stick buttons
    130         std::vector<shared_ptr<JoyStickButtonVector> > joyStickButtons_;
     130        std::vector<std::shared_ptr<JoyStickButtonVector>> joyStickButtons_;
    131131        //! Helper class to use something like std:vector<HalfAxis[48]>
    132132        struct JoyStickAxisVector
     
    136136        };
    137137        //! Actual key bindings for joy stick axes (and sliders)
    138         std::vector<shared_ptr<JoyStickAxisVector> > joyStickAxes_;
     138        std::vector<std::shared_ptr<JoyStickAxisVector>> joyStickAxes_;
    139139
    140140        //! Pointer map with all Buttons, including half axes
     
    143143        std::vector<HalfAxis*> allHalfAxes_;
    144144        //! Maps input commands to all Button names, including half axes
    145         std::map< std::string, std::vector<std::string> > allCommands_;
     145        std::map< std::string, std::vector<std::string>> allCommands_;
    146146
    147147        /**
     
    160160        //! Name of the file used in this KeyBinder (constant!)
    161161        const std::string filename_;
    162         //! Config file used. NULL in case of KeyDetector. Also indicates whether we've already loaded.
     162        //! Config file used. nullptr in case of KeyDetector. Also indicates whether we've already loaded.
    163163        ConfigFile* configFile_;
    164164        //! Config file from the data directory that only serves as fallback
     
    227227    {
    228228        // execute all buffered bindings (additional parameter)
    229         for (unsigned int i = 0; i < paramCommandBuffer_.size(); i++)
     229        for (BufferedParamCommand* command : paramCommandBuffer_)
    230230        {
    231             paramCommandBuffer_[i]->rel_ *= dt;
    232             paramCommandBuffer_[i]->execute();
     231            command->rel_ *= dt;
     232            command->execute();
    233233        }
    234234
    235235        // always reset the relative movement of the mouse
    236         for (unsigned int i = 0; i < MouseAxisCode::numberOfAxes * 2; i++)
    237             mouseAxes_[i].relVal_ = 0.0f;
     236        for (HalfAxis& axis : mouseAxes_)
     237            axis.relVal_ = 0.0f;
    238238    }
    239239}// tolua_export
  • code/trunk/src/libraries/core/input/KeyBinderManager.cc

    r10624 r11071  
    5656
    5757    KeyBinderManager::KeyBinderManager()
    58         : currentBinder_(NULL)
     58        : currentBinder_(nullptr)
    5959        , bDefaultFileLoaded_(true)
    6060        , bBinding_(false)
     
    7676    {
    7777        // Delete all remaining KeyBinders
    78         for (std::map<std::string, KeyBinder*>::const_iterator it = this->binders_.begin(); it != this->binders_.end(); ++it)
    79             delete it->second;
     78        for (const auto& mapEntry : this->binders_)
     79            delete mapEntry.second;
    8080
    8181        // Reset console commands
    82         ModifyConsoleCommand(__CC_keybind_name ).setObject(0);
    83         ModifyConsoleCommand(__CC_tkeybind_name).setObject(0);
    84         ModifyConsoleCommand(__CC_unbind_name  ).setObject(0);
    85         ModifyConsoleCommand(__CC_tunbind_name ).setObject(0);
     82        ModifyConsoleCommand(__CC_keybind_name ).setObject(nullptr);
     83        ModifyConsoleCommand(__CC_tkeybind_name).setObject(nullptr);
     84        ModifyConsoleCommand(__CC_unbind_name  ).setObject(nullptr);
     85        ModifyConsoleCommand(__CC_tunbind_name ).setObject(nullptr);
    8686    }
    8787
     
    205205    void KeyBinderManager::registerKeybindCallback(LuaFunctor* function)
    206206    {
    207         this->callbackFunction_ = function;
     207        this->callbackFunction_.reset(function);
    208208    }
    209209}
  • code/trunk/src/libraries/core/input/KeyBinderManager.h

    r9667 r11071  
    3434#include <map>
    3535#include <string>
     36#include <memory>
    3637
    3738#include "util/Singleton.h"
     
    101102
    102103    private:
    103         KeyBinderManager(const KeyBinderManager&);
     104        // non-copyable:
     105        KeyBinderManager(const KeyBinderManager&) = delete;
     106        KeyBinderManager& operator=(const KeyBinderManager&) = delete;
     107
    104108        void keybindInternal(const std::string& command, bool bTemporary);
    105109        void keybindKeyPressed(const std::string& keyName);
     
    107111
    108112        // KeyBinder management
    109         KeyBinder* currentBinder_;                   //! Currently selected KeyBinder (never NULL!)
    110         std::map<std::string, KeyBinder*> binders_;  //! All loaded KeyBinders
    111         bool bDefaultFileLoaded_;                    //! Tells whether the default one is loaded
    112         std::string defaultFilename_;                //! Name of the file with the default key bindings
     113        KeyBinder* currentBinder_;                      //! Currently selected KeyBinder (never nullptr!)
     114        std::map<std::string, KeyBinder*> binders_;     //! All loaded KeyBinders
     115        bool bDefaultFileLoaded_;                       //! Tells whether the default one is loaded
     116        std::string defaultFilename_;                   //! Name of the file with the default key bindings
    113117
    114118        // keybind command related
    115         SharedPtr<LuaFunctor> callbackFunction_;     //! Function to be called when key was pressed after "keybind" command
    116         bool bBinding_;                              //! Tells whether a key binding process is active
    117         bool bTemporary_;                            //! Stores tkeybind/keybind value
    118         std::string command_;                        //! Stores the command received by (t)keybind
     119        std::shared_ptr<LuaFunctor> callbackFunction_;  //! Function to be called when key was pressed after "keybind" command
     120        bool bBinding_;                                 //! Tells whether a key binding process is active
     121        bool bTemporary_;                               //! Stores tkeybind/keybind value
     122        std::string command_;                           //! Stores the command received by (t)keybind
    119123
    120124        static KeyBinderManager* singletonPtr_s;
  • code/trunk/src/libraries/core/input/KeyDetector.cc

    r10624 r11071  
    6262    KeyDetector::~KeyDetector()
    6363    {
    64         inputState_->setHandler(NULL);
     64        inputState_->setHandler(nullptr);
    6565        InputManager::getInstance().destroyState("detector");
    6666        ModifyConsoleCommand(__CC_KeyDetector_callback_name).resetFunction();
     
    7070    {
    7171        // Assign every button/axis the same command, but with its name as argument
    72         for (std::map<std::string, Button*>::const_iterator it = allButtons_.begin(); it != allButtons_.end(); ++it)
    73             it->second->parse(__CC_KeyDetector_callback_name + ' ' + it->second->groupName_ + "." + it->second->name_);
     72        for (const auto& mapEntry : allButtons_)
     73            mapEntry.second->parse(__CC_KeyDetector_callback_name + ' ' + mapEntry.second->groupName_ + "." + mapEntry.second->name_);
    7474    }
    7575
  • code/trunk/src/libraries/core/input/KeyDetector.h

    r8729 r11071  
    4848
    4949    private:
    50         KeyDetector(const KeyDetector&);
     50        // non-copyable:
     51        KeyDetector(const KeyDetector&) = delete;
     52        KeyDetector& operator=(const KeyDetector&) = delete;
    5153
    5254        void callback(const std::string& name);
    53         void JoyStickQuantityChanged(const std::vector<JoyStick*>& joyStickList);
     55        virtual void JoyStickQuantityChanged(const std::vector<JoyStick*>& joyStickList) override;
    5456        void assignCommands();
    5557
  • code/trunk/src/libraries/core/input/Keyboard.h

    r8729 r11071  
    6363        //! Only resets the keyboard modifiers. Initialising is done in the base class.
    6464        Keyboard(unsigned int id, OIS::InputManager* oisInputManager) : super(id, oisInputManager), modifiers_(0) { }
    65         ~Keyboard() { }
     65        ~Keyboard() = default;
    6666
    6767    private:
     
    7575        }
    7676
    77         bool keyPressed(const OIS::KeyEvent& arg);
    78         bool keyReleased(const OIS::KeyEvent& arg);
     77        virtual bool keyPressed(const OIS::KeyEvent& arg) override;
     78        virtual bool keyReleased(const OIS::KeyEvent& arg) override;
    7979
    8080        //! Returns the class name as string
  • code/trunk/src/libraries/core/input/Mouse.cc

    r10624 r11071  
    6868    {
    6969#ifdef ORXONOX_PLATFORM_LINUX
    70         ModifyConsoleCommand(__CC_Mouse_name, __CC_grab_name).setObject(0);
    71         ModifyConsoleCommand(__CC_Mouse_name, __CC_ungrab_name).setObject(0);
     70        ModifyConsoleCommand(__CC_Mouse_name, __CC_grab_name).setObject(nullptr);
     71        ModifyConsoleCommand(__CC_Mouse_name, __CC_ungrab_name).setObject(nullptr);
    7272#endif
    7373    }
     
    8282            IntVector2 rel(e.state.X.rel, e.state.Y.rel);
    8383            IntVector2 clippingSize(e.state.width, e.state.height);
    84             for (unsigned int i = 0; i < inputStates_.size(); ++i)
    85                 inputStates_[i]->mouseMoved(abs, rel, clippingSize);
     84            for (InputState* state : inputStates_)
     85                state->mouseMoved(abs, rel, clippingSize);
    8686        }
    8787
     
    8989        if (e.state.Z.rel != 0)
    9090        {
    91             for (unsigned int i = 0; i < inputStates_.size(); ++i)
    92                 inputStates_[i]->mouseScrolled(e.state.Z.abs, e.state.Z.rel);
     91            for (InputState* state : inputStates_)
     92                state->mouseScrolled(e.state.Z.abs, e.state.Z.rel);
    9393        }
    9494
  • code/trunk/src/libraries/core/input/Mouse.h

    r7809 r11071  
    7474    private:
    7575        //! OIS event handler
    76         bool mousePressed(const OIS::MouseEvent &arg, OIS::MouseButtonID id)
     76        virtual bool mousePressed(const OIS::MouseEvent &arg, OIS::MouseButtonID id) override
    7777        {
    7878            super::buttonPressed(static_cast<MouseButtonCode::ByEnum>(id));
     
    8181
    8282        //! OIS event handler
    83         bool mouseReleased(const OIS::MouseEvent &arg, OIS::MouseButtonID id)
     83        virtual bool mouseReleased(const OIS::MouseEvent &arg, OIS::MouseButtonID id) override
    8484        {
    8585            super::buttonReleased(static_cast<MouseButtonCode::ByEnum>(id));
     
    8787        }
    8888
    89         bool mouseMoved(const OIS::MouseEvent &arg);
     89        virtual bool mouseMoved(const OIS::MouseEvent &arg) override;
    9090
    91         void windowResized(unsigned int newWidth, unsigned int newHeight);
     91        virtual void windowResized(unsigned int newWidth, unsigned int newHeight) override;
    9292
    9393        // Returns the class name as string
Note: See TracChangeset for help on using the changeset viewer.