MCPcopy Create free account
hub / github.com/Redot-Engine/redot-engine / action_press

Method action_press

core/input/input.cpp:1095–1111  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1093}
1094
1095void 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
1113void 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));

Callers 1

_pressMethod · 0.80

Calls 6

CLAMPFunction · 0.85
has_actionMethod · 0.80
suggest_actionsMethod · 0.80
ObjectIDClass · 0.50
get_physics_framesMethod · 0.45
get_process_framesMethod · 0.45

Tested by

no test coverage detected