From 6c184aafe0db33e1175cb0edf6a14321f10f6bf0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Simon=20L=C3=BCbe=C3=9F?= Date: Thu, 3 Sep 2026 22:36:15 +0200 Subject: [PATCH] Correctly use ScriptGlue functions for Input queries --- ScriptCore/Input.cs | 38 +++++++++++++++----------------------- 1 file changed, 15 insertions(+), 23 deletions(-) diff --git a/ScriptCore/Input.cs b/ScriptCore/Input.cs index c69febf..3fec2a0 100644 --- a/ScriptCore/Input.cs +++ b/ScriptCore/Input.cs @@ -1,4 +1,5 @@ using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; namespace GlitchyEngine; @@ -11,66 +12,57 @@ public static class Input /// Returns if the specified key is in the pressed down state. /// /// The key to query. - [MethodImpl(MethodImplOptions.InternalCall)] - public static extern bool IsKeyPressed(Key key); - + public static bool IsKeyPressed(Key key) => ScriptGlue.Input_IsKeyPressed(key); + /// /// Returns if the specified is in the released state. /// /// The key to query. - [MethodImpl(MethodImplOptions.InternalCall)] - public static extern bool IsKeyReleased(Key key); - + public static bool IsKeyReleased(Key key) => ScriptGlue.Input_IsKeyReleased(key); + /// /// Returns if the state of the specified changed this frame (i.e. changed from pressed to released or from released to pressed). /// /// The key to query. - [MethodImpl(MethodImplOptions.InternalCall)] - public static extern bool IsKeyToggled(Key key); + public static bool IsKeyToggled(Key key) => ScriptGlue.Input_IsKeyToggled(key); /// /// Returns if is being pressed down this frame /// ( was last frame and is this frame). /// /// The key to query. - [MethodImpl(MethodImplOptions.InternalCall)] - public static extern bool IsKeyPressing(Key key); - + public static bool IsKeyPressing(Key key) => ScriptGlue.Input_IsKeyPressing(key); + /// /// Returns if is being released this frame /// ( was last frame and is this frame). /// /// The key to query. - [MethodImpl(MethodImplOptions.InternalCall)] - public static extern bool IsKeyReleasing(Key key); - + public static bool IsKeyReleasing(Key key) => ScriptGlue.Input_IsKeyReleasing(key); + /// /// Returns if the specified mouse button is in the pressed down state. /// /// The button to query. - [MethodImpl(MethodImplOptions.InternalCall)] - public static extern bool IsMouseButtonPressed(MouseButton mouseButton); + public static bool IsMouseButtonPressed(MouseButton mouseButton) => ScriptGlue.Input_IsMouseButtonPressed(mouseButton); /// /// Returns if the specified mouse button is in the released state. /// /// The button to query. - [MethodImpl(MethodImplOptions.InternalCall)] - public static extern bool IsMouseButtonReleased(MouseButton mouseButton); - + public static bool IsMouseButtonReleased(MouseButton mouseButton) => ScriptGlue.Input_IsMouseButtonReleased(mouseButton); + /// /// Returns if the mouse button is being pressed down this frame /// ( was last frame and is this frame). /// /// The button to query. - [MethodImpl(MethodImplOptions.InternalCall)] - public static extern bool IsMouseButtonPressing(MouseButton mouseButton); + public static bool IsMouseButtonPressing(MouseButton mouseButton) => ScriptGlue.Input_IsMouseButtonPressing(mouseButton); /// /// Returns if the mouse button is being released this frame /// ( was last frame and is this frame). /// /// The button to query. - [MethodImpl(MethodImplOptions.InternalCall)] - public static extern bool IsMouseButtonReleasing(MouseButton mouseButton); + public static bool IsMouseButtonReleasing(MouseButton mouseButton) => ScriptGlue.Input_IsMouseButtonReleasing(mouseButton); }