MCPcopy Create free account
hub / github.com/defold/defold / UpdateActionPressedReleasedRepeated

Function UpdateActionPressedReleasedRepeated

engine/input/src/input.cpp:591–614  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

589 }
590
591 void UpdateActionPressedReleasedRepeated(Action* action, Context* context, float dt)
592 {
593 float pressed_threshold = context->m_PressedThreshold;
594 action->m_Pressed = (action->m_PrevValue < pressed_threshold && action->m_Value >= pressed_threshold) ? 1 : 0;
595 action->m_Released = (action->m_PrevValue >= pressed_threshold && action->m_Value < pressed_threshold) ? 1 : 0;
596
597 action->m_Repeated = false;
598 if (action->m_Value > 0.0f)
599 {
600 if (action->m_Pressed)
601 {
602 action->m_RepeatTimer = context->m_RepeatDelay;
603 }
604 else
605 {
606 action->m_RepeatTimer -= dt;
607 if (action->m_RepeatTimer <= 0.0f)
608 {
609 action->m_Repeated = true;
610 action->m_RepeatTimer += context->m_RepeatInterval;
611 }
612 }
613 }
614 }
615
616 void UpdateBinding(HBinding binding, float dt)
617 {

Callers 1

UpdateBindingFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected