Changeset 11071 for code/trunk/src/libraries/core/input/KeyBinder.cc
- Timestamp:
- Jan 17, 2016, 10:29:21 PM (9 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.cc
r11052 r11071 53 53 : deriveTime_(0.0f) 54 54 , filename_(filename) 55 , configFile_( NULL)56 , fallbackConfigFile_( NULL)55 , configFile_(nullptr) 56 , fallbackConfigFile_(nullptr) 57 57 { 58 58 mouseRelative_[0] = 0; … … 153 153 void KeyBinder::buttonThresholdChanged() 154 154 { 155 for ( unsigned int i = 0; i < allHalfAxes_.size(); i++)156 if (! allHalfAxes_[i]->bButtonThresholdUser_)157 allHalfAxes_[i]->buttonThreshold_ = this->buttonThreshold_;155 for (HalfAxis* halfAxis : allHalfAxes_) 156 if (!halfAxis->bButtonThresholdUser_) 157 halfAxis->buttonThreshold_ = this->buttonThreshold_; 158 158 } 159 159 … … 170 170 171 171 // load the bindings if required 172 if (configFile_ != NULL)172 if (configFile_ != nullptr) 173 173 { 174 174 for (unsigned int iDev = oldValue; iDev < joySticks_.size(); ++iDev) … … 188 188 { 189 189 while (joyStickAxes_.size() < joySticks_.size()) 190 joyStickAxes_.push_back(s hared_ptr<JoyStickAxisVector>(new JoyStickAxisVector()));190 joyStickAxes_.push_back(std::make_shared<JoyStickAxisVector>()); 191 191 while (joyStickButtons_.size() < joySticks_.size()) 192 joyStickButtons_.push_back(s hared_ptr<JoyStickButtonVector>(new JoyStickButtonVector()));192 joyStickButtons_.push_back(std::make_shared<JoyStickButtonVector>()); 193 193 // For the case the new size is smaller 194 194 this->joyStickAxes_.resize(joySticks_.size()); … … 274 274 275 275 // Parse bindings and create the ConfigValueContainers if necessary 276 for ( std::map<std::string, Button*>::const_iterator it = allButtons_.begin(); it != allButtons_.end(); ++it)277 { 278 it->second->readBinding(this->configFile_, this->fallbackConfigFile_);279 addButtonToCommand( it->second->bindingString_, it->second);276 for (const auto& mapEntry : allButtons_) 277 { 278 mapEntry.second->readBinding(this->configFile_, this->fallbackConfigFile_); 279 addButtonToCommand(mapEntry.second->bindingString_, mapEntry.second); 280 280 } 281 281 … … 420 420 void KeyBinder::clearBindings() 421 421 { 422 for ( std::map<std::string, Button*>::const_iterator it = allButtons_.begin(); it != allButtons_.end(); ++it)423 it->second->clear();424 425 for ( unsigned int i = 0; i < paramCommandBuffer_.size(); i++)426 delete paramCommandBuffer_[i];422 for (const auto& mapEntry : allButtons_) 423 mapEntry.second->clear(); 424 425 for (BufferedParamCommand* command : paramCommandBuffer_) 426 delete command; 427 427 paramCommandBuffer_.clear(); 428 428 } … … 434 434 { 435 435 // iterate over all buttons 436 for ( std::map<std::string, Button*>::iterator it = this->allButtons_.begin(); it != this->allButtons_.end(); ++it)437 { 438 Button* button = it->second;436 for (const auto& mapEntry : this->allButtons_) 437 { 438 Button* button = mapEntry.second; 439 439 440 440 // iterate over all modes … … 479 479 { 480 480 delete[] button->commands_[mode_index]; 481 button->commands_[mode_index] = 0;481 button->commands_[mode_index] = nullptr; 482 482 } 483 483 … … 505 505 this->mousePosition_[1] = 0.0f; 506 506 507 for ( unsigned int i = 0; i < MouseAxisCode::numberOfAxes * 2; i++)508 mouseAxes_[i].reset();507 for (HalfAxis& axis : mouseAxes_) 508 axis.reset(); 509 509 } 510 510 … … 545 545 } 546 546 547 for ( unsigned int i = 0; i < MouseAxisCode::numberOfAxes * 2; i++)547 for (HalfAxis& axis : mouseAxes_) 548 548 { 549 549 // Why dividing relative value by dt? The reason lies in the simple fact, that when you … … 555 555 { 556 556 // just ignore if dt == 0.0 because we have multiplied by 0.0 anyway.. 557 mouseAxes_[i].relVal_ /= dt;558 } 559 560 tickHalfAxis( mouseAxes_[i]);557 axis.relVal_ /= dt; 558 } 559 560 tickHalfAxis(axis); 561 561 } 562 562 }
Note: See TracChangeset
for help on using the changeset viewer.