MCPcopy Create free account
hub / github.com/RavEngine/RavEngine / tick

Method tick

src/InputManager.cpp:42–77  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

40}
41
42void 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

Callers

nothing calls this directly

Calls 5

IsCorrectStateMethod · 0.80
fFunction · 0.50
findMethod · 0.45
endMethod · 0.45
clearMethod · 0.45

Tested by

no test coverage detected