Assigns every distinct Component type (a concrete EntityStruct
subclass, or a mixin like Transform2D/Child) one stable bit, the
first time ComponentDescriptor.has<T>() sees it.
The bit is what makes archetype matching a single machine instruction
later: a query compiles to a required-mask/forbidden-mask pair, and
"does this archetype match?" becomes signature & required == required
against ArchetypeStorage.componentSignature - no per-entity type
tests, no map lookups, in the loop that runs for every entity every
tick. That is the whole reason the registry exists here, ahead of the
query system that will consume it.
Assignment order is first-seen order, which means it depends on scene declaration order. That is fine within a process (signatures are only ever compared to other signatures produced in the same process) but makes a signature meaningless to serialize - don't persist one.
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Properties
- assignedCount → int
-
Number of distinct component types seen so far.
no setter
Static Methods
-
bitFor(
Type type) → int -
The single-bit mask for
type, assigning a fresh bit if this is the first sighting. Returns a mask, not an index, because every caller wants to OR it into a signature. -
indexFor(
Type type) → int -
The bit index (0..63) for
type. Exposed for diagnostics and for the future multi-word widening; bitFor is what callers normally want. -
reset(
) → void - Test-only escape hatch: this registry is process-global by design, so a test suite that declares many throwaway component types would otherwise march into maxComponentTypes for reasons that have nothing to do with the code under test.
Constants
- maxComponentTypes → const int
-
One 64-bit
intper signature word, and we currently use exactly one word - so 64 distinct component types is the hard ceiling. Widening to a 2-word (orUint64List-backed) signature is a mechanical follow-up - every consumer goes through bitFor and ArchetypeStorage.componentSignature - but it costs the "match is one AND" property above, so it is deliberately not attempted now.