Added isKeyPressed C# api

This commit is contained in:
Antoine Pilote
2024-03-16 12:15:40 -04:00
parent 268de51af2
commit ea1339a8e8
2 changed files with 13 additions and 0 deletions

View File

@@ -11,6 +11,11 @@ namespace Nuake {
return Input::IsKeyDown(keyCode);
}
bool IsKeyPressed(int keyCode)
{
return Input::IsKeyPressed(keyCode);
}
Coral::NativeArray<float> GetMousePosition()
{
Vector2 mousePosition = Input::GetMousePosition();
@@ -21,6 +26,8 @@ namespace Nuake {
void InputNetAPI::RegisterMethods()
{
RegisterMethod("Input.IsKeyDownIcall", &IsKeyDown);
RegisterMethod("Input.IsKeyPressedIcall", &IsKeyPressed);
RegisterMethod("Input.GetMousePositionIcall", &GetMousePosition);
}

View File

@@ -135,6 +135,7 @@ namespace Nuake.Net
public class Input
{
internal static unsafe delegate*<int, bool> IsKeyDownIcall;
internal static unsafe delegate*<int, bool> IsKeyPressedIcall;
internal static unsafe delegate*<NativeArray<float>> GetMousePositionIcall;
public static bool IsKeyDown(Key keys)
@@ -142,6 +143,11 @@ namespace Nuake.Net
unsafe { return IsKeyDownIcall((int)keys); }
}
public static bool IsKeyPressed(Key key)
{
unsafe { return IsKeyPressedIcall((int)key); }
}
public static Vector2 GetMousePosition()
{
NativeArray<float> result;