Changeset 9978
- Timestamp:
- Jan 4, 2014, 9:48:04 PM (11 years ago)
- Location:
- code/trunk/src/libraries/core
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
code/trunk/src/libraries/core/CorePrereqs.h
r9703 r9978 106 106 OnHold, 107 107 OnRelease, 108 OnPressAndRelease, 108 109 None 109 110 }; -
code/trunk/src/libraries/core/input/Button.cc
r9667 r9978 138 138 else if (token == "onrelease") 139 139 mode = KeybindMode::OnRelease; 140 else if (token == "onpressandrelease") 141 mode = KeybindMode::OnPressAndRelease; 140 142 else if (token == "onhold") 141 143 mode = KeybindMode::OnHold; … … 216 218 { 217 219 mode = eval.getConsoleCommand()->getKeybindMode(); 218 commands[mode].push_back(cmd);220 this->addCommand(cmd, mode, commands); 219 221 } 220 222 } … … 232 234 cmd->setFixedKeybindMode(true); 233 235 234 commands[mode].push_back(cmd);236 this->addCommand(cmd, mode, commands); 235 237 } 236 238 } … … 251 253 } 252 254 255 inline void Button::addCommand(BaseCommand* cmd, KeybindMode::Value mode, std::vector<BaseCommand*> commands[3]) 256 { 257 if (mode == KeybindMode::OnPressAndRelease) 258 { 259 BaseCommand* cmd2 = cmd->clone(); 260 261 commands[KeybindMode::OnPress].push_back(cmd); 262 commands[KeybindMode::OnRelease].push_back(cmd2); // clone 263 } 264 else 265 commands[mode].push_back(cmd); 266 } 267 253 268 inline void Button::parseError(const std::string& message, bool serious) 254 269 { -
code/trunk/src/libraries/core/input/Button.h
r6536 r9978 75 75 private: 76 76 void parseError(const std::string& message, bool serious); 77 void addCommand(BaseCommand* cmd, KeybindMode::Value mode, std::vector<BaseCommand*> commands[3]); 77 78 }; 78 79 -
code/trunk/src/libraries/core/input/InputCommands.h
r7891 r9978 67 67 { return this->bFixedKeybindMode_; } 68 68 69 virtual BaseCommand* clone() = 0; 70 69 71 private: 70 72 bool bFixedKeybindMode_; … … 76 78 bool execute(float abs = 1.0f, float rel = 1.0f); 77 79 CommandEvaluation* getEvaluation(); 80 virtual SimpleCommand* clone() { return new SimpleCommand(*this); } 78 81 79 82 CommandEvaluation evaluation_; … … 103 106 bool execute(float abs = 1.0f, float rel = 1.0f); 104 107 CommandEvaluation* getEvaluation(); 108 virtual ParamCommand* clone() { return new ParamCommand(*this); } 105 109 106 110 float scale_; -
code/trunk/src/libraries/core/input/KeyBinder.h
r7861 r9978 195 195 196 196 inline void KeyBinder::buttonPressed (const KeyEvent& evt) 197 { assert(!keys_[evt.getKeyCode()].name_.empty()); keys_[evt.getKeyCode()].execute(KeybindMode::OnPress ); }197 { assert(!keys_[evt.getKeyCode()].name_.empty()); keys_[evt.getKeyCode()].execute(KeybindMode::OnPress, 1); } 198 198 199 199 inline void KeyBinder::buttonReleased(const KeyEvent& evt) 200 { assert(!keys_[evt.getKeyCode()].name_.empty()); keys_[evt.getKeyCode()].execute(KeybindMode::OnRelease ); }200 { assert(!keys_[evt.getKeyCode()].name_.empty()); keys_[evt.getKeyCode()].execute(KeybindMode::OnRelease, 0); } 201 201 202 202 inline void KeyBinder::buttonHeld (const KeyEvent& evt) … … 205 205 206 206 inline void KeyBinder::buttonPressed (MouseButtonCode::ByEnum button) 207 { mouseButtons_[button].execute(KeybindMode::OnPress ); }207 { mouseButtons_[button].execute(KeybindMode::OnPress, 1); } 208 208 209 209 inline void KeyBinder::buttonReleased(MouseButtonCode::ByEnum button) 210 { mouseButtons_[button].execute(KeybindMode::OnRelease ); }210 { mouseButtons_[button].execute(KeybindMode::OnRelease, 0); } 211 211 212 212 inline void KeyBinder::buttonHeld (MouseButtonCode::ByEnum button) … … 215 215 216 216 inline void KeyBinder::buttonPressed (unsigned int device, JoyStickButtonCode::ByEnum button) 217 { (*joyStickButtons_[device])[button].execute(KeybindMode::OnPress ); }217 { (*joyStickButtons_[device])[button].execute(KeybindMode::OnPress, 1); } 218 218 219 219 inline void KeyBinder::buttonReleased(unsigned int device, JoyStickButtonCode::ByEnum button) 220 { (*joyStickButtons_[device])[button].execute(KeybindMode::OnRelease ); }220 { (*joyStickButtons_[device])[button].execute(KeybindMode::OnRelease, 0); } 221 221 222 222 inline void KeyBinder::buttonHeld (unsigned int device, JoyStickButtonCode::ByEnum button)
Note: See TracChangeset
for help on using the changeset viewer.