Beispiel #1
0
                    /// <summary>
                    /// Used to update the key bind with each tick of the Binds.Update function.
                    /// </summary>
                    public void UpdatePress(bool isPressed)
                    {
                        wasPressed = IsPressed;
                        IsPressed  = isPressed;

                        if (IsNewPressed)
                        {
                            NewPressed?.Invoke();
                            stopwatch.Restart();
                        }

                        if (IsPressed && stopwatch.ElapsedTicks > holdTime)
                        {
                            if (!IsPressedAndHeld)
                            {
                                PressedAndHeld?.Invoke();
                            }

                            IsPressedAndHeld = true;
                        }
                        else
                        {
                            IsPressedAndHeld = false;
                        }

                        if (IsReleased)
                        {
                            Released?.Invoke();
                        }
                    }
Beispiel #2
0
 private void OnPressedAndHeld()
 {
     PressedAndHeld?.Invoke(this, EventArgs.Empty);
 }