| 40 | } |
| 41 | |
| 42 | void InputManager::tick() { |
| 43 | //action mappings |
| 44 | for (Event& evt : actionValues){ |
| 45 | //get the list of functions to invoke |
| 46 | for (auto& a : codeToAction[evt.ID]) { |
| 47 | if (actionMappings.find(a) != actionMappings.end()) { |
| 48 | auto toInvoke = actionMappings.at(a); |
| 49 | |
| 50 | //determine which to invoke |
| 51 | for (auto& action : toInvoke) { |
| 52 | if (action.IsCorrectState(evt.value)) { |
| 53 | action(); |
| 54 | } |
| 55 | } |
| 56 | } |
| 57 | } |
| 58 | } |
| 59 | actionValues.clear(); |
| 60 | |
| 61 | //call all axis mappings |
| 62 | for (auto& pair : codeToAxis){ |
| 63 | for (auto& a : pair.second) { |
| 64 | if (axisMappings.find(a) != axisMappings.end()) { |
| 65 | auto scale = axisScalars[pair.first]; |
| 66 | auto val = /*scale * */ axisValues[pair.first]; |
| 67 | for (auto& f : axisMappings.at(a)) { |
| 68 | f(val, scale); |
| 69 | } |
| 70 | } |
| 71 | } |
| 72 | } |
| 73 | |
| 74 | //mouse velocity needs to be cleared |
| 75 | reg_axis(static_cast<int>(Special::MOUSEMOVE_XVEL), 0); |
| 76 | reg_axis(static_cast<int>(Special::MOUSEMOVE_YVEL), 0); |
| 77 | } |
| 78 | |
| 79 | /** |
| 80 | * Add a key event |
nothing calls this directly
no test coverage detected