Renamed exe to Nuake Engine + added C# endpoints i forgot to push

This commit is contained in:
Antoine Pilote
2024-09-08 23:17:51 -04:00
parent f30e178e87
commit e36e33aa9a
2 changed files with 17 additions and 0 deletions

View File

@@ -23,6 +23,7 @@ namespace Nuake.Net
public class Entity
{
internal static unsafe delegate*<int, int, bool> EntityHasComponentIcall;
internal static unsafe delegate*<int, int, void> EntityAddComponentIcall;
internal static unsafe delegate*<int, bool> EntityHasManagedInstanceIcall;
internal static unsafe delegate*<int, NativeString, int> EntityGetEntityIcall;
internal static unsafe delegate*<int, NativeString> EntityGetNameIcall;
@@ -207,6 +208,20 @@ namespace Nuake.Net
return false;
}
public T? AddComponent<T>() where T : IComponent
{
if(HasComponent<T>())
{
return (T?)Activator.CreateInstance(typeof(T), ECSHandle);
}
unsafe
{
EntityAddComponentIcall(ECSHandle, (int)MappingTypeEnum[typeof(T)]);
return (T?)Activator.CreateInstance(typeof(T), ECSHandle);
};
}
public T? GetComponent<T>() where T : IComponent
{
if (HasComponent<T>())

View File

@@ -356,11 +356,13 @@ project "NuakeRuntime"
project "Editor"
location "Editor"
targetname ("Nuake Engine")
kind "ConsoleApp"
language "C++"
cppdialect "C++20"
staticruntime "On"
dependson { "NuakeNet" }
targetdir ("bin/" .. outputdir .. "/%{prj.name}")
objdir ("bin-int/" .. outputdir .. "/%{prj.name}")
debugdir ("%{prj.name}")