First pass scriptable subsystems that has the same lifetime of the engine

This commit is contained in:
WiggleWizard
2024-09-18 12:44:46 +01:00
parent 67d7865a20
commit 510b577f49
17 changed files with 219 additions and 6 deletions

View File

@@ -0,0 +1,6 @@
namespace Nuake.Net;
public class EngineSubsystem
{
}

View File

@@ -0,0 +1,6 @@
namespace Nuake.Net;
public class EngineTickableSubsystem
{
}

View File

@@ -5,6 +5,7 @@ using System.Collections;
using System.Collections.Generic;
using System.Drawing;
using System.Numerics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
@@ -18,6 +19,8 @@ namespace Nuake.Net
{
internal static unsafe delegate*<NativeString, void> LoggerLogIcall;
internal static unsafe delegate*<NativeString, void> LoadSceneIcall;
internal static unsafe delegate*<NativeString, NativeInstance<EngineSubsystem>> GetSubsystemByNameIcall;
public Engine() { }
public static void LoadScene(string path)
@@ -33,6 +36,14 @@ namespace Nuake.Net
{
unsafe { LoggerLogIcall(input); }
}
public static T? GetSubsystem<T>() where T : EngineSubsystem
{
unsafe
{
return (T?)GetSubsystemByNameIcall(typeof(T).FullName);
}
}
}
public struct AABB