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.
 
 

108 lines
2.7 KiB

using gaemstone.ECS;
namespace gaemstone.Flecs;
[BuiltIn, Module, Path("/flecs/core")]
public partial class Core
{
// Entity Tags
[Tag] public struct Module { }
[Tag] public struct Private { }
[Tag] public struct Prefab { }
[Tag] public struct Disabled { }
[Tag] public struct SlotOf { }
[Tag] public struct Flag { }
// Component / Relationship Properties
[Entity, Path("*")] public struct Wildcard { }
[Entity, Path("_")] public struct Any { }
[Entity, Path("this")] public struct This { }
[Entity, Path("$")] public struct Variable { }
[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 { }
[Tag] public struct Traversable { }
[Relation, Tag] public struct With { }
[Tag] public struct OneOf { }
// Entity Relationships
[Relation, Tag] public struct ChildOf { }
[Relation, Tag] public struct IsA { }
[Relation, Tag] public struct DependsOn { }
// Identifier Tags
[Tag] public struct Name { }
[Tag] public struct Symbol { }
[Tag] public struct Alias { }
// Observer Events
[Entity] public struct OnAdd { }
[Entity] public struct OnRemove { }
[Entity] public struct OnSet { }
[Entity] public struct UnSet { }
[Entity] public struct OnTableCreate { }
[Entity] public struct OnTableDelete { }
[Entity] public struct OnTableEmpty { }
[Entity] public struct OnTableFilled { }
// Related to Deletion Events
[Relation, Tag] public struct OnDelete { }
[Relation, Tag] public struct OnDeleteTarget { }
[Tag] public struct Remove { }
[Tag] public struct Delete { }
[Tag] public struct Panic { }
// 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 {
// TODO: What does Flecs do if you give it "" as an identifier?
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();
}
}