Skip to content

Commit

Permalink
update types
Browse files Browse the repository at this point in the history
  • Loading branch information
mreinstein committed Jul 3, 2024
1 parent 4fad3b4 commit 6a50e0a
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 13 deletions.
8 changes: 8 additions & 0 deletions types/component-set.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
/**
* Track an entity, component tuple as a unique key in a set.
*/
export function create(): any[];
export function includes(set: any, entity: any, componentName: any): boolean;
export function add(set: any, entity: any, componentName: any): void;
export function remove(set: any, entity: any, componentName: any): void;
//# sourceMappingURL=component-set.d.ts.map
1 change: 1 addition & 0 deletions types/component-set.d.ts.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

21 changes: 9 additions & 12 deletions types/ecs.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,8 @@
*/
/**
* @typedef { Object } DeferredRemovalMap
* @prop {number[]} entities indexes into entities array, sorted from highest to lowest
* @prop {string[]} components [ entity index, component name ] pairs sorted from highest to lowest
* Stored as a string but seperated with `__@@ECS@@__`
* @prop {number[]} entities
* @prop {string[]} components [ entity, component name ]
*/
/**
* @typedef { Object } WorldStats
Expand Down Expand Up @@ -213,11 +212,11 @@ declare namespace _default {
export { cleanup };
}
export default _default;
export type ListenerType = 'added' | 'removed';
export type ListenerType = "added" | "removed";
export type ListenerResult = Entity[];
export type Component = any;
export type Entity = {
[key: string]: any;
[key: string]: Component;
};
export type FilteredEntityList = Entity[];
export type SystemUpdateFunction = (dt: number) => void;
Expand All @@ -229,10 +228,12 @@ export type System = {
onUpdate?: SystemUpdateFunction;
onPostUpdate?: SystemUpdateFunction;
};
export type SystemFunction = (world: World) => System;
export type SystemFunction = {
(world: World): System;
};
export type Listener = any;
export type ListenerMap = {
[key: string]: any;
[key: string]: Listener;
};
export type ListenerChangeMap = {
added: ListenerMap;
Expand All @@ -242,13 +243,9 @@ export type FilterMap = {
[filterId: string]: FilteredEntityList;
};
export type DeferredRemovalMap = {
/**
* indexes into entities array, sorted from highest to lowest
*/
entities: number[];
/**
* [ entity index, component name ] pairs sorted from highest to lowest
* Stored as a string but seperated with `__@@ECS@@__`
* [ entity, component name ]
*/
components: string[];
};
Expand Down
2 changes: 1 addition & 1 deletion types/ecs.d.ts.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 6a50e0a

Please sign in to comment.