| 36 | } |
| 37 | |
| 38 | bool Joystick::HandleInputChange(ControllerInput::Input input, float val, uint32_t sequence_id) { |
| 39 | float depth = val; |
| 40 | std::ostringstream oss; |
| 41 | switch (input) { |
| 42 | case ControllerInput::L_STICK_XN: |
| 43 | case ControllerInput::L_STICK_XP: |
| 44 | case ControllerInput::L_STICK_YN: |
| 45 | case ControllerInput::L_STICK_YP: |
| 46 | case ControllerInput::R_STICK_XN: |
| 47 | case ControllerInput::R_STICK_XP: |
| 48 | case ControllerInput::R_STICK_YN: |
| 49 | case ControllerInput::R_STICK_YP: |
| 50 | case ControllerInput::L_TRIGGER: |
| 51 | case ControllerInput::R_TRIGGER: |
| 52 | depth = NormalizeJoystick(std::fabs(val)); |
| 53 | break; |
| 54 | default: |
| 55 | break; |
| 56 | } |
| 57 | |
| 58 | bool ret_val = false; |
| 59 | if (depth > 0.0f) { |
| 60 | AddInputBufferItem(input, depth, sequence_id); |
| 61 | ret_val = true; |
| 62 | } |
| 63 | |
| 64 | std::pair<BindingMap::iterator, BindingMap::iterator> iter_pair = binding_.equal_range(input); |
| 65 | if (iter_pair.first != binding_.end()) { |
| 66 | for (BindingMap::iterator iter = iter_pair.first; iter != iter_pair.second; ++iter) { |
| 67 | SetButtonDown(iter->second, depth); |
| 68 | } |
| 69 | } |
| 70 | |
| 71 | return ret_val; |
| 72 | } |
| 73 | |
| 74 | void Joystick::ProcessBinding(ControllerInput::Input input, const std::string command) { |
| 75 | binding_.insert(std::pair<ControllerInput::Input, std::string>(input, command)); |
no test coverage detected