Changeset 10916 for code/branches/cpp11_v2/src/libraries/core/input
- Timestamp:
- Dec 2, 2015, 11:22:03 PM (9 years ago)
- Location:
- code/branches/cpp11_v2/src/libraries/core/input
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/cpp11_v2/src/libraries/core/input/Button.cc
r10821 r10916 196 196 197 197 // add command to the buffer if not yet existing 198 for ( auto & elem: *paramCommandBuffer_)199 { 200 if ( elem->evaluation_.getConsoleCommand()198 for (BufferedParamCommand* command : *paramCommandBuffer_) 199 { 200 if (command->evaluation_.getConsoleCommand() 201 201 == eval.getConsoleCommand()) 202 202 { 203 203 // already in list 204 cmd->paramCommand_ = elem;204 cmd->paramCommand_ = command; 205 205 break; 206 206 } -
code/branches/cpp11_v2/src/libraries/core/input/InputBuffer.cc
r10821 r10916 110 110 void InputBuffer::insert(const std::string& input, bool update) 111 111 { 112 for ( auto & elem: input)113 { 114 this->insert( elem, false);112 for (const char& inputChar : input) 113 { 114 this->insert(inputChar, false); 115 115 116 116 if (update) 117 this->updated( elem, false);117 this->updated(inputChar, false); 118 118 } 119 119 … … 170 170 void InputBuffer::updated() 171 171 { 172 for ( auto & elem: this->listeners_)173 { 174 if ( (elem)->bListenToAllChanges_)175 (elem)->callFunction();172 for (BaseInputBufferListenerTuple* listener : this->listeners_) 173 { 174 if (listener->bListenToAllChanges_) 175 listener->callFunction(); 176 176 } 177 177 } … … 179 179 void InputBuffer::updated(const char& update, bool bSingleInput) 180 180 { 181 for ( auto & elem: this->listeners_)182 { 183 if ((! (elem)->trueKeyFalseChar_) && ((elem)->bListenToAllChanges_ || ((elem)->char_ == update)) && (!(elem)->bOnlySingleInput_ || bSingleInput))184 (elem)->callFunction();181 for (BaseInputBufferListenerTuple* listener : this->listeners_) 182 { 183 if ((!listener->trueKeyFalseChar_) && (listener->bListenToAllChanges_ || (listener->char_ == update)) && (!listener->bOnlySingleInput_ || bSingleInput)) 184 listener->callFunction(); 185 185 } 186 186 } … … 201 201 return; 202 202 203 for ( auto & elem: this->listeners_)204 { 205 if ( (elem)->trueKeyFalseChar_ && ((elem)->key_ == evt.getKeyCode()))206 (elem)->callFunction();203 for (BaseInputBufferListenerTuple* listener : this->listeners_) 204 { 205 if (listener->trueKeyFalseChar_ && (listener->key_ == evt.getKeyCode())) 206 listener->callFunction(); 207 207 } 208 208 -
code/branches/cpp11_v2/src/libraries/core/input/InputDevice.h
r10845 r10916 158 158 159 159 // Call all the states with the held button event 160 for ( auto& button : pressedButtons_)161 for ( auto &state : inputStates_)160 for (ButtonType& button : pressedButtons_) 161 for (InputState* state : inputStates_) 162 162 state->template buttonEvent<ButtonEvent::THold, typename Traits::ButtonTypeParam>( 163 163 this->getDeviceID(), static_cast<DeviceClass*>(this)->getButtonEventArg(button)); 164 164 165 165 // Call states with device update events 166 for ( auto & elem: inputStates_)167 elem->update(time.getDeltaTime(), this->getDeviceID());166 for (InputState* state : inputStates_) 167 state->update(time.getDeltaTime(), this->getDeviceID()); 168 168 169 169 static_cast<DeviceClass*>(this)->updateImpl(time); … … 196 196 197 197 // Call states 198 for ( auto & elem: inputStates_)199 elem->template buttonEvent<ButtonEvent::TPress, typename Traits::ButtonTypeParam>(this->getDeviceID(), static_cast<DeviceClass*>(this)->getButtonEventArg(button));198 for (InputState* state : inputStates_) 199 state->template buttonEvent<ButtonEvent::TPress, typename Traits::ButtonTypeParam>(this->getDeviceID(), static_cast<DeviceClass*>(this)->getButtonEventArg(button)); 200 200 } 201 201 … … 218 218 219 219 // Call states 220 for ( auto & elem: inputStates_)221 elem->template buttonEvent<ButtonEvent::TRelease, typename Traits::ButtonTypeParam>(this->getDeviceID(), static_cast<DeviceClass*>(this)->getButtonEventArg(button));220 for (InputState* state : inputStates_) 221 state->template buttonEvent<ButtonEvent::TRelease, typename Traits::ButtonTypeParam>(this->getDeviceID(), static_cast<DeviceClass*>(this)->getButtonEventArg(button)); 222 222 } 223 223 -
code/branches/cpp11_v2/src/libraries/core/input/InputManager.cc
r10821 r10916 373 373 // check whether a state has changed its EMPTY situation 374 374 bool bUpdateRequired = false; 375 for (auto & elem: activeStates_)376 { 377 if ( elem.second->hasExpired())378 { 379 elem.second->resetExpiration();375 for (auto& mapEntry : activeStates_) 376 { 377 if (mapEntry.second->hasExpired()) 378 { 379 mapEntry.second->resetExpiration(); 380 380 bUpdateRequired = true; 381 381 } … … 391 391 392 392 // Collect function calls for the update 393 for ( auto & elem: activeStatesTicked_)394 elem->update(time.getDeltaTime());393 for (InputState* state : activeStatesTicked_) 394 state->update(time.getDeltaTime()); 395 395 396 396 // Execute all cached function calls in order … … 401 401 // If we delay the calls, then OIS and and the InputStates are not anymore 402 402 // in the call stack and can therefore be edited. 403 for (auto & elem: this->callBuffer_)404 elem();403 for (auto& function : this->callBuffer_) 404 function(); 405 405 406 406 this->callBuffer_.clear(); … … 437 437 // Using an std::set to avoid duplicates 438 438 std::set<InputState*> tempSet; 439 for ( auto & elem: devices_)440 if ( elem!= nullptr)441 for (unsigned int iState = 0; iState < elem->getStateListRef().size(); ++iState)442 tempSet.insert( elem->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]); 443 443 444 444 // Copy the content of the std::set back to the actual vector 445 445 activeStatesTicked_.clear(); 446 for ( const auto & elem: tempSet)447 activeStatesTicked_.push_back( elem);446 for (InputState* state : tempSet) 447 activeStatesTicked_.push_back(state); 448 448 449 449 // Check whether we have to change the mouse mode -
code/branches/cpp11_v2/src/libraries/core/input/JoyStick.cc
r10821 r10916 186 186 void JoyStick::clearBuffersImpl() 187 187 { 188 for ( auto & elem: povStates_)189 elem= 0;188 for (int& state : povStates_) 189 state = 0; 190 190 } 191 191 -
code/branches/cpp11_v2/src/libraries/core/input/KeyBinder.cc
r10821 r10916 153 153 void KeyBinder::buttonThresholdChanged() 154 154 { 155 for ( auto & elem: allHalfAxes_)156 if (! elem->bButtonThresholdUser_)157 elem->buttonThreshold_ = this->buttonThreshold_;155 for (HalfAxis* halfAxis : allHalfAxes_) 156 if (!halfAxis->bButtonThresholdUser_) 157 halfAxis->buttonThreshold_ = this->buttonThreshold_; 158 158 } 159 159 … … 383 383 it->second->clear(); 384 384 385 for ( auto & elem: paramCommandBuffer_)386 delete elem;385 for (BufferedParamCommand* command : paramCommandBuffer_) 386 delete command; 387 387 paramCommandBuffer_.clear(); 388 388 } … … 394 394 { 395 395 // iterate over all buttons 396 for (const auto & elem: this->allButtons_)397 { 398 Button* button = elem.second;396 for (const auto& mapEntry : this->allButtons_) 397 { 398 Button* button = mapEntry.second; 399 399 400 400 // iterate over all modes … … 465 465 this->mousePosition_[1] = 0.0f; 466 466 467 for ( auto & elem: mouseAxes_)468 elem.reset();467 for (HalfAxis& axis : mouseAxes_) 468 axis.reset(); 469 469 } 470 470 … … 505 505 } 506 506 507 for ( auto & elem: mouseAxes_)507 for (HalfAxis& axis : mouseAxes_) 508 508 { 509 509 // Why dividing relative value by dt? The reason lies in the simple fact, that when you … … 515 515 { 516 516 // just ignore if dt == 0.0 because we have multiplied by 0.0 anyway.. 517 elem.relVal_ /= dt;518 } 519 520 tickHalfAxis( elem);517 axis.relVal_ /= dt; 518 } 519 520 tickHalfAxis(axis); 521 521 } 522 522 } -
code/branches/cpp11_v2/src/libraries/core/input/KeyBinder.h
r10845 r10916 226 226 { 227 227 // execute all buffered bindings (additional parameter) 228 for ( auto & elem: paramCommandBuffer_)228 for (BufferedParamCommand* command : paramCommandBuffer_) 229 229 { 230 elem->rel_ *= dt;231 elem->execute();230 command->rel_ *= dt; 231 command->execute(); 232 232 } 233 233 234 234 // always reset the relative movement of the mouse 235 for ( auto & elem: mouseAxes_)236 elem.relVal_ = 0.0f;235 for (HalfAxis& axis : mouseAxes_) 236 axis.relVal_ = 0.0f; 237 237 } 238 238 }// tolua_export -
code/branches/cpp11_v2/src/libraries/core/input/Mouse.cc
r10821 r10916 82 82 IntVector2 rel(e.state.X.rel, e.state.Y.rel); 83 83 IntVector2 clippingSize(e.state.width, e.state.height); 84 for ( auto & elem: inputStates_)85 elem->mouseMoved(abs, rel, clippingSize);84 for (InputState* state : inputStates_) 85 state->mouseMoved(abs, rel, clippingSize); 86 86 } 87 87 … … 89 89 if (e.state.Z.rel != 0) 90 90 { 91 for ( auto & elem: inputStates_)92 elem->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); 93 93 } 94 94
Note: See TracChangeset
for help on using the changeset viewer.