if (ev is InputEventMouse) { var mouseEvent = (InputEventMouse)ev; Vector2 mousePos = mouseEvent.Position; } else if (ev is InputEventKey) { var keyEvent = (InputEventKey)ev; bool aPressed = keyEvent.Pressed && keyEvent.Scancode == GD.KEY_A; }
switch (ev) { case InputEventMouse mouseEvent: Vector2 mousePos = mouseEvent.Position; break; case InputEventKey keyEvent: bool aPressed = keyEvent.Pressed && keyEvent.Scancode == GD.KEY_A; break; }
if (ev is InputEventMouse mouseEvent) { Vector2 mousePos = mouseEvent.Position; } else if (ev is InputEventKey keyEvent) { bool aPressed = keyEvent.Pressed && keyEvent.Scancode == GD.KEY_A; }