Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Aug 21, 2010, 9:52:13 PM (14 years ago)
Author:
landauf
Message:

createFunctor() now returns a SharedPtr instead of a pointer. Adapted code that uses createFunctor() accordingly.

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

Legend:

Unmodified
Added
Removed
  • code/branches/consolecommands3/src/libraries/core/input/InputState.h

    r6746 r7198  
    150150        void left();
    151151        //! Sets a functor to be called upon activation of the state
    152         void setEnterFunctor(Functor* functor) { this->enterFunctor_ = functor; }
     152        void setEnterFunctor(const FunctorPtr& functor) { this->enterFunctor_ = functor; }
    153153        //! Sets a functor to be called upon deactivation of the state
    154         void setLeaveFunctor(Functor* functor) { this->leaveFunctor_ = functor; }
     154        void setLeaveFunctor(const FunctorPtr& functor) { this->leaveFunctor_ = functor; }
    155155
    156156    private:
     
    172172        //! Handler to be used for all joy sticks (needs to be saved in case another joy stick gets attached)
    173173        InputHandler*               joyStickHandlerAll_;
    174         Functor                  enterFunctor_;          //!< Functor to be executed on enter
    175         Functor                  leaveFunctor_;          //!< Functor to be executed on leave
     174        FunctorPtr                  enterFunctor_;          //!< Functor to be executed on enter
     175        FunctorPtr                  leaveFunctor_;          //!< Functor to be executed on leave
    176176    };
    177177
  • code/branches/consolecommands3/src/libraries/core/input/KeyBinderManager.cc

    r6417 r7198  
    156156        {
    157157            COUT(0) << "Press any button/key or move a mouse/joystick axis" << std::endl;
    158             KeyDetector::getInstance().setCallback(shared_ptr<Functor>(createFunctor(&KeyBinderManager::keybindKeyPressed, this)));
     158            KeyDetector::getInstance().setCallback(createFunctor(&KeyBinderManager::keybindKeyPressed, this));
    159159            InputManager::getInstance().enterState("detector");
    160160            this->command_ = command;
  • code/branches/consolecommands3/src/libraries/core/input/KeyBinderManager.h

    r6417 r7198  
    9999        void unbind(const std::string& binding); //tolua_export
    100100        void tunbind(const std::string& binding);
    101         inline void registerKeybindCallback(Functor* function) { this->callbackFunction_.reset(function); } // tolua_export
     101        inline void registerKeybindCallback(const FunctorPtr& function) { this->callbackFunction_ = function; } // tolua//_//export // <-- FIXME
    102102
    103103    private:
     
    114114
    115115        // keybind command related
    116         shared_ptr<Functor> callbackFunction_;       //! Function to be called when key was pressed after "keybind" command
     116        FunctorPtr callbackFunction_;                //! Function to be called when key was pressed after "keybind" command
    117117        bool bBinding_;                              //! Tells whether a key binding process is active
    118118        bool bTemporary_;                            //! Stores tkeybind/keybind value
  • code/branches/consolecommands3/src/libraries/core/input/KeyDetector.h

    r6417 r7198  
    4646        ~KeyDetector();
    4747
    48         void setCallback(const shared_ptr<Functor>& function) { this->callbackFunction_ = function; }
     48        void setCallback(const FunctorPtr& function) { this->callbackFunction_ = function; }
    4949
    5050    private:
     
    5555        void assignCommands();
    5656
    57         shared_ptr<Functor> callbackFunction_;
     57        FunctorPtr callbackFunction_;
    5858        InputState* inputState_;
    5959        static std::string callbackCommand_s;
Note: See TracChangeset for help on using the changeset viewer.