- Timestamp:
- Jan 10, 2016, 1:54:11 PM (9 years ago)
- Location:
- code/branches/cpp11_v3
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/cpp11_v3
- Property svn:mergeinfo changed
-
code/branches/cpp11_v3/src/libraries/core/input/InputDevice.h
r8858 r11054 60 60 //! Only resets the members 61 61 InputDevice(unsigned int id) : bCalibrating_(false), deviceID_(id) { } 62 virtual ~InputDevice() { }62 virtual ~InputDevice() = default; 63 63 //! Returns the device class (derived) name as string 64 64 virtual std::string getClassName() const = 0; … … 99 99 100 100 private: 101 InputDevice(const InputDevice& rhs); //!< Don't use! 101 // non-copyable: 102 InputDevice(const InputDevice&) = delete; 103 InputDevice& operator=(const InputDevice&) = delete; 102 104 103 105 bool bCalibrating_; //!< Whether the device is in calibration mode … … 153 155 154 156 //! Captures OIS events (which then get distributed to the derived class) and creates the button held events 155 v oid update(const Clock& time)157 virtual void update(const Clock& time) override 156 158 { 157 159 oisDevice_->capture(); 158 160 159 161 // 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)); 164 166 165 167 // 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()); 168 170 169 171 static_cast<DeviceClass*>(this)->updateImpl(time); … … 171 173 172 174 //! Clears the list of pressed buttons and calls the derived class's method 173 v oid clearBuffers()175 virtual void clearBuffers() override 174 176 { 175 177 pressedButtons_.clear(); … … 180 182 OISDeviceClass* getOISDevice() { return this->oisDevice_; } 181 183 // 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(); } 183 185 184 186 protected: … … 196 198 197 199 // 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)); 200 202 } 201 203 … … 218 220 219 221 // 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)); 222 224 } 223 225
Note: See TracChangeset
for help on using the changeset viewer.