| 1093 | } |
| 1094 | |
| 1095 | void Input::action_press(const StringName &p_action, float p_strength) { |
| 1096 | ERR_FAIL_COND_MSG(!InputMap::get_singleton()->has_action(p_action), InputMap::get_singleton()->suggest_actions(p_action)); |
| 1097 | |
| 1098 | // Create or retrieve existing action. |
| 1099 | ActionState &action_state = action_states[p_action]; |
| 1100 | |
| 1101 | // As input may come in part way through a physics tick, the earliest we can react to it is the next physics tick. |
| 1102 | if (!action_state.cache.pressed) { |
| 1103 | action_state.pressed_event_id = ObjectID(); |
| 1104 | action_state.pressed_physics_frame = Engine::get_singleton()->get_physics_frames() + 1; |
| 1105 | action_state.pressed_process_frame = Engine::get_singleton()->get_process_frames(); |
| 1106 | } |
| 1107 | action_state.exact = true; |
| 1108 | action_state.api_pressed = true; |
| 1109 | action_state.api_strength = CLAMP(p_strength, 0.0f, 1.0f); |
| 1110 | _update_action_cache(p_action, action_state); |
| 1111 | } |
| 1112 | |
| 1113 | void Input::action_release(const StringName &p_action) { |
| 1114 | ERR_FAIL_COND_MSG(!InputMap::get_singleton()->has_action(p_action), InputMap::get_singleton()->suggest_actions(p_action)); |
no test coverage detected