Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Oct 13, 2009, 5:05:17 PM (15 years ago)
Author:
dafrick
Message:

Hopefully merged trunk successfully into pickup branch.

Location:
code/branches/pickup
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • code/branches/pickup

  • code/branches/pickup/src/libraries/core/input/KeyBinder.h

    r5781 r5935  
    2626 *
    2727 */
    28 
    29 /**
    30 @file
    31 @brief
    32     Different definitions of input processing.
    33 */
    3428
    3529#ifndef _KeyBinder_H__
     
    5347    /**
    5448    @brief
    55         Handles mouse, keyboard and joy stick input while in the actual game mode.
    56         Manages the key bindings.
     49        Maps mouse, keyboard and joy stick input to command strings and executes them.
     50
     51        The bindings are stored in ini-files (like the one for configValues) in the config Path.
     52    @remarks
     53        You cannot change the filename because the KeyBinderManager maps these filenames to the
     54        KeyBinders. If you need to load other bindings, just create a new one.
    5755    */
    5856    class _CoreExport KeyBinder : public InputHandler, public JoyStickQuantityListener
    5957    {
    6058    public:
    61         KeyBinder ();
     59        KeyBinder (const std::string& filename);
    6260        virtual ~KeyBinder();
    6361
    64         void loadBindings(const std::string& filename);
    6562        void clearBindings();
    6663        bool setBinding(const std::string& binding, const std::string& name, bool bTemporary = false);
     64        const std::string& getBindingsFilename()
     65            { return this->filename_; }
    6766        void setConfigValues();
    6867        void resetJoyStickAxes();
    6968
    7069    protected: // functions
     70        void loadBindings();
     71        void buttonThresholdChanged();
     72        void initialiseJoyStickBindings();
     73        void compilePointerLists();
     74        // from JoyStickQuantityListener interface
     75        virtual void JoyStickQuantityChanged(const std::vector<JoyStick*>& joyStickList);
     76
    7177        void allDevicesUpdated(float dt);
    7278        void mouseUpdated(float dt);
     
    7480        // internal
    7581        void tickHalfAxis(HalfAxis& halfAxis);
    76 
    77         void buttonThresholdChanged();
    78         // from JoyStickQuantityListener interface
    79         virtual void JoyStickQuantityChanged(const std::vector<JoyStick*>& joyStickList);
    80         void initialiseJoyStickBindings();
    81         void compilePointerLists();
    8282
    8383        void buttonPressed (const KeyEvent& evt);
     
    144144        float deriveTime_;
    145145
     146        //! Name of the file used in this KeyBinder (constant!)
     147        const std::string filename_;
    146148        //! Config file used. ConfigFileType::NoType in case of KeyDetector. Also indicates whether we've already loaded.
    147149        ConfigFileType configFile_;
     
    171173    };
    172174
     175
    173176    inline void KeyBinder::buttonPressed (const KeyEvent& evt)
    174177    { assert(!keys_[evt.getKeyCode()].name_.empty()); keys_[evt.getKeyCode()].execute(KeybindMode::OnPress); }
Note: See TracChangeset for help on using the changeset viewer.