mirror of
https://github.com/Ukendio/jecs.git
synced 2025-08-05 03:39:17 +00:00
Compare commits
4 commits
cf30621a20
...
12bd3e6339
Author | SHA1 | Date | |
---|---|---|---|
|
12bd3e6339 | ||
|
28ef8d7234 | ||
|
8e35900f65 | ||
|
96bed9bd7e |
1 changed files with 16 additions and 7 deletions
23
jecs.d.ts
vendored
23
jecs.d.ts
vendored
|
@ -151,6 +151,14 @@ export class World {
|
||||||
*/
|
*/
|
||||||
add<C>(entity: Entity, component: undefined extends InferComponent<C> ? C : Id<undefined>): void;
|
add<C>(entity: Entity, component: undefined extends InferComponent<C> ? C : Id<undefined>): void;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Assigns a value to a component on the given entity.
|
||||||
|
* @param entity The target entity.
|
||||||
|
* @param component The component definition (could be a Pair or Entity).
|
||||||
|
* @param value The value to store with that component.
|
||||||
|
*/
|
||||||
|
set<T>(entity: Entity, component: Id<T>, value: T): void;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Installs a hook on the given component.
|
* Installs a hook on the given component.
|
||||||
* @param component The target component.
|
* @param component The target component.
|
||||||
|
@ -158,15 +166,13 @@ export class World {
|
||||||
* @param value The hook callback.
|
* @param value The hook callback.
|
||||||
*/
|
*/
|
||||||
set<T>(component: Entity<T>, hook: StatefulHook, value: (e: Entity<T>, id: Id<T>, data: T) => void): void;
|
set<T>(component: Entity<T>, hook: StatefulHook, value: (e: Entity<T>, id: Id<T>, data: T) => void): void;
|
||||||
set<T>(component: Entity<T>, hook: StatelessHook, value: (e: Entity<T>, id: Id<T>) => void): void;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Assigns a value to a component on the given entity.
|
* Installs a hook on the given component.
|
||||||
* @param entity The target entity.
|
* @param component The target component.
|
||||||
* @param component The component definition (could be a Pair or Entity).
|
* @param hook The hook to install.
|
||||||
* @param value The value to store with that component.
|
* @param value The hook callback.
|
||||||
*/
|
*/
|
||||||
set<E extends Id<unknown>>(entity: Entity, component: E, value: InferComponent<E>): void;
|
set<T>(component: Entity<T>, hook: StatelessHook, value: (e: Entity<T>, id: Id<T>) => void): void;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Cleans up the world by removing empty archetypes and rebuilding the archetype collections.
|
* Cleans up the world by removing empty archetypes and rebuilding the archetype collections.
|
||||||
|
@ -289,6 +295,9 @@ export function pair_first<P, O>(world: World, p: Pair<P, O>): Entity<P>;
|
||||||
*/
|
*/
|
||||||
export function pair_second<P, O>(world: World, p: Pair<P, O>): Entity<O>;
|
export function pair_second<P, O>(world: World, p: Pair<P, O>): Entity<O>;
|
||||||
|
|
||||||
|
export function ECS_PAIR_FIRST(pair: Pair): number;
|
||||||
|
export function ECS_PAIR_SECOND(pair: Pair): number;
|
||||||
|
|
||||||
type StatefulHook = Entity<<T>(e: Entity<T>, id: Id<T>, data: T) => void> & {
|
type StatefulHook = Entity<<T>(e: Entity<T>, id: Id<T>, data: T) => void> & {
|
||||||
readonly __nominal_StatefulHook: unique symbol,
|
readonly __nominal_StatefulHook: unique symbol,
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue