private void InvokeEvents() { foreach (var key in Enum.GetValues(typeof(Keys)).Cast <Keys>()) { if (IsKeyDown(key)) { OnKeyDown?.Invoke(key); if (IsKeyPressed(key)) { OnKeyPressed?.Invoke(key); } if (IsKeyClicked(key)) { OnKeyClicked?.Invoke(key); } } else { OnKeyUp?.Invoke(key); if (IsKeyReleased(key)) { OnKeyReleased?.Invoke(key); } } } }
internal void InitKeyboardHandlers() { _keyboardHandler = new KeyboardHandler(); _keyboardHandler.OnKeyDown += (key) => OnKeyDown?.Invoke(key); _keyboardHandler.OnKeyUp += (key) => OnKeyUp?.Invoke(key); _keyboardHandler.OnKeyPressed += (key) => OnKeyPressed?.Invoke(key); _keyboardHandler.OnKeyClicked += (key) => OnKeyClicked?.Invoke(key); _keyboardHandler.OnKeyReleased += (key) => OnKeyReleased?.Invoke(key); }