Changeset 11071 for code/trunk/src/libraries/core/input/KeyBinder.h
- Timestamp:
- Jan 17, 2016, 10:29:21 PM (8 years ago)
- Location:
- code/trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
code/trunk
- Property svn:mergeinfo changed
-
code/trunk/src/libraries/core/input/KeyBinder.h
r11052 r11071 36 36 #include <vector> 37 37 #include <map> 38 #include < boost/shared_ptr.hpp>38 #include <memory> 39 39 40 40 #include "InputHandler.h" … … 85 85 void compilePointerLists(); 86 86 // from JoyStickQuantityListener interface 87 virtual void JoyStickQuantityChanged(const std::vector<JoyStick*>& joyStickList) ;88 89 v oid allDevicesUpdated(float dt);90 v oid mouseUpdated(float dt);91 v oid 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; 92 92 // internal 93 93 void tickHalfAxis(HalfAxis& halfAxis); 94 94 95 v oid buttonPressed (const KeyEvent& evt);96 v oid buttonReleased(const KeyEvent& evt);97 v oid buttonHeld (const KeyEvent& evt);98 99 v oid buttonPressed (MouseButtonCode::ByEnum button);100 v oid buttonReleased(MouseButtonCode::ByEnum button);101 v oid buttonHeld (MouseButtonCode::ByEnum button);102 v oid mouseMoved (IntVector2 abs, IntVector2 rel, IntVector2 clippingSize);103 v oid mouseScrolled (int abs, int rel);104 105 v oid buttonPressed (unsigned int device, JoyStickButtonCode::ByEnum button);106 v oid buttonReleased(unsigned int device, JoyStickButtonCode::ByEnum button);107 v oid buttonHeld (unsigned int device, JoyStickButtonCode::ByEnum button);108 v oid 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; 109 109 110 110 protected: // variables … … 128 128 }; 129 129 //! Actual key bindings for joy stick buttons 130 std::vector<s hared_ptr<JoyStickButtonVector>> joyStickButtons_;130 std::vector<std::shared_ptr<JoyStickButtonVector>> joyStickButtons_; 131 131 //! Helper class to use something like std:vector<HalfAxis[48]> 132 132 struct JoyStickAxisVector … … 136 136 }; 137 137 //! Actual key bindings for joy stick axes (and sliders) 138 std::vector<s hared_ptr<JoyStickAxisVector>> joyStickAxes_;138 std::vector<std::shared_ptr<JoyStickAxisVector>> joyStickAxes_; 139 139 140 140 //! Pointer map with all Buttons, including half axes … … 143 143 std::vector<HalfAxis*> allHalfAxes_; 144 144 //! Maps input commands to all Button names, including half axes 145 std::map< std::string, std::vector<std::string> 145 std::map< std::string, std::vector<std::string>> allCommands_; 146 146 147 147 /** … … 160 160 //! Name of the file used in this KeyBinder (constant!) 161 161 const std::string filename_; 162 //! Config file used. NULLin 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. 163 163 ConfigFile* configFile_; 164 164 //! Config file from the data directory that only serves as fallback … … 227 227 { 228 228 // execute all buffered bindings (additional parameter) 229 for ( unsigned int i = 0; i < paramCommandBuffer_.size(); i++)229 for (BufferedParamCommand* command : paramCommandBuffer_) 230 230 { 231 paramCommandBuffer_[i]->rel_ *= dt;232 paramCommandBuffer_[i]->execute();231 command->rel_ *= dt; 232 command->execute(); 233 233 } 234 234 235 235 // 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; 238 238 } 239 239 }// tolua_export
Note: See TracChangeset
for help on using the changeset viewer.