You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
40 lines
1003 B
40 lines
1003 B
using System.Runtime.InteropServices; |
|
using gaemstone.ECS; |
|
using gaemstone.ECS.Utility; |
|
using static flecs_hub.flecs; |
|
|
|
namespace gaemstone.Flecs; |
|
|
|
[BuiltIn, Module, Path("/flecs/doc")] |
|
public unsafe partial class Doc |
|
: IModuleImport |
|
{ |
|
[Tag] public struct Brief { } |
|
[Tag] public struct Detail { } |
|
[Tag] public struct Link { } |
|
[Tag] public struct Color { } |
|
|
|
[Relation, Component] |
|
public struct Description |
|
{ |
|
internal unsafe void* Value; |
|
|
|
public override string? ToString() |
|
{ unsafe { return Marshal.PtrToStringUTF8((nint)Value); } } |
|
public static implicit operator string?(Description desc) |
|
=> desc.ToString(); |
|
} |
|
|
|
|
|
static Entity<T> IModuleImport.Import<T>(World<T> world) |
|
{ |
|
using var alloc = TempAllocator.Use(); |
|
return Entity<T>.GetOrThrow(world, new(ecs_import_c(world, |
|
new() { Data = new() { Pointer = &DocImport } }, |
|
alloc.AllocateCString("FlecsDoc")))); |
|
} |
|
|
|
[UnmanagedCallersOnly] |
|
private static void DocImport(ecs_world_t* world) |
|
=> FlecsDocImport(world); |
|
}
|
|
|