public override void Update()
        {
            // This check handles the case where the game window focus changes during key events causing it to drop WM_KEYUP events
            if (heldKeys.Count > 0)
            {
                foreach (var key in heldKeys)
                {
                    if ((Win32Native.GetKeyState((int)key) & 0x8000) == 0)
                    {
                        keysToRelease.Add(key);
                    }
                }

                foreach (var keyToRelease in keysToRelease)
                {
                    keyboard?.HandleKeyUp(keyToRelease);
                    heldKeys.Remove(keyToRelease);
                }

                keysToRelease.Clear();
            }
        }
        private void UIControlOnLostFocus(object sender, EventArgs eventArgs)
        {
            // Release keys/buttons when control focus is lost (this prevents some keys getting stuck when a focus loss happens when moving the camera)
            if (keyboard != null)
            {
                foreach (var key in keyboard.KeyRepeats.Keys.ToArray())
                {
                    keyboard.HandleKeyUp(key);
                }
            }

            mouse?.ForceReleaseButtons();
        }