Aadded GetLocalPosition and IsMouseButtonDown to .Net API

This commit is contained in:
Antoine Pilote
2024-04-18 20:08:28 -04:00
parent 89846a6885
commit 9164bccd88
4 changed files with 47 additions and 1 deletions

View File

@@ -52,6 +52,7 @@ namespace Nuake.Net
public class TransformComponent : IComponent
{
internal static unsafe delegate*<int, NativeArray<float>> GetGlobalPositionIcall;
internal static unsafe delegate*<int, NativeArray<float>> GetPositionIcall;
internal static unsafe delegate*<int, float, float, float, void> SetPositionIcall;
internal static unsafe delegate*<int, float, float, float, void> RotateIcall;
@@ -83,7 +84,14 @@ namespace Nuake.Net
public Vector3 LocalPosition
{
get { return new Vector3(); }
get
{
unsafe
{
NativeArray<float> result = GetPositionIcall(EntityID);
return new Vector3(result[0], result[1], result[2]);
}
}
set
{
unsafe { SetPositionIcall(EntityID, value.X, value.Y, value.Z); }

View File

@@ -132,13 +132,31 @@ namespace Nuake.Net
MENU = 348,
}
public enum MouseButton
{
BUTTON_LEFT = 0,
BUTTON_RIGHT = 1,
BUTTON_MIDDLE = 2,
BUTTON_4 = 3,
BUTTON_5 = 4,
BUTTON_6 = 5,
BUTTON_7 = 6,
BUTTON_8 = 7,
}
public class Input
{
internal static unsafe delegate*<bool, void> ShowMouseIcall;
internal static unsafe delegate*<int, bool> IsKeyDownIcall;
internal static unsafe delegate*<int, bool> IsKeyPressedIcall;
internal static unsafe delegate*<int, bool> IsMouseButtonDownIcall;
internal static unsafe delegate*<NativeArray<float>> GetMousePositionIcall;
public static bool IsMouseButtonDown(MouseButton button)
{
unsafe { return IsMouseButtonDownIcall((int)button); }
}
public static void ShowMouse(bool visible)
{
unsafe { ShowMouseIcall(visible); }