|
|
|
using System.Runtime.InteropServices;
|
|
|
|
using gaemstone.ECS;
|
|
|
|
using gaemstone.Utility;
|
|
|
|
using static flecs_hub.flecs;
|
|
|
|
|
|
|
|
namespace gaemstone.Flecs.Systems;
|
|
|
|
|
|
|
|
[Module, Path("/flecs/rest")]
|
|
|
|
public unsafe class Rest
|
|
|
|
: IModuleInitializer
|
|
|
|
{
|
|
|
|
public void Initialize(EntityRef module)
|
|
|
|
{
|
|
|
|
using (var alloc = TempAllocator.Use())
|
|
|
|
ecs_import_c(module.World, new() { Data = new() {
|
|
|
|
Pointer = &RestImport } }, alloc.AllocateCString("FlecsRest"));
|
|
|
|
|
|
|
|
module.NewChild("Rest").Build()
|
|
|
|
.CreateLookup<EcsRest>()
|
|
|
|
.Set(new EcsRest { port = 27750 });
|
|
|
|
}
|
|
|
|
|
|
|
|
[UnmanagedCallersOnly]
|
|
|
|
private static void RestImport(ecs_world_t* world)
|
|
|
|
=> FlecsRestImport(world);
|
|
|
|
}
|