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.
 
 

83 lines
2.1 KiB

using gaemstone.ECS;
namespace gaemstone.Flecs;
[Module, Path("/flecs/core")]
public static class Core
{
// Entity Tags
[Tag] public struct Name { }
[Tag] public struct Symbol { }
[Tag] public struct Alias { }
[Tag] public struct Module { }
[Tag] public struct Prefab { }
[Tag] public struct SlotOf { }
[Tag] public struct Disabled { }
[Tag] public struct Empty { }
// Can't be in a module class with the same name.
[Path("/flecs/system/System")]
[Tag] public struct System { }
// Entities
[Entity] public struct World { }
[Path("*")] public struct Wildcard { }
[Path("_")] public struct Any { }
[Entity] public struct This { }
[Path("$")] public struct Variable { }
[Entity] public struct Flag { }
// Entity Relationships
[Relation, Tag] public struct IsA { }
[Relation, Tag] public struct ChildOf { }
[Relation, Tag] public struct DependsOn { }
// Component / Relationship Properties
[Tag] public struct Transitive { }
[Tag] public struct Reflexive { }
[Tag] public struct Symmetric { }
[Tag] public struct Final { }
[Tag] public struct DontInherit { }
[Tag] public struct Tag { }
[Tag] public struct Union { }
[Tag] public struct Exclusive { }
[Tag] public struct Acyclic { }
[Relation, Tag] public struct With { }
[Tag] public struct OneOf { }
// Components
[Component]
public readonly struct Component
{
public int Size { get; }
public int Alignment { get; }
}
[Relation, Component]
public readonly struct Identifier
{
#pragma warning disable IDE0051 // Disable "unused" hint.
#pragma warning disable CS0169 // Disable "unused" warning.
#pragma warning disable CS0649 // Disable "never assigned to" warning.
private unsafe readonly void* _value;
private readonly nint _length;
private readonly ulong _hash;
private readonly ulong _indexHash;
private unsafe readonly void* _index;
#pragma warning restore
public override string? ToString() { unsafe {
if ((_value == null) || (_length == 0)) return null;
else return new UTF8View(new(_value, (int)_length)).ToString();
} }
public static implicit operator string?(Identifier id)
=> id.ToString();
}
}