implemented functions from NativeFunctions.cs

This commit is contained in:
2025-07-05 03:22:48 +03:00
parent f7a8d32865
commit 175fe61e5c
7 changed files with 53 additions and 14 deletions

View File

@@ -39,7 +39,7 @@ public class GameObject
static public GameObject Create()
{
NativeMethods.createGameObject(out ulong id, out uint index);
NativeFunctions.createGameObject(out ulong id, out uint index);
var o = new GameObject(id, index);
return o;
}
@@ -49,7 +49,7 @@ public class GameObject
if(_isDestroyed)
return;
_isDestroyed = NativeMethods.destroyGameObject(_index);
_isDestroyed = NativeFunctions.freeGameObject(_index);
if(!_isDestroyed)
throw new Exception($"Can't destroy GameObject({_id})");
}

View File

@@ -3,11 +3,11 @@ using System.Runtime.InteropServices;
namespace Ougge;
internal static class NativeMethods
internal static class NativeFunctions
{
[DllImport("__Internal")]
internal extern static bool destroyGameObject(uint index);
[DllImport("__Internal")]
internal extern static void createGameObject(out ulong id, out uint index);
[DllImport("__Internal")]
internal extern static bool freeGameObject(uint index);
}