Created
January 26, 2020 12:17
-
-
Save lucas-jones/88e8f02a87a3871f92f5d86b6d2c5001 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
abstract class System<T extends { [index:string]:Component[] }> { | |
query: { [P in keyof T]?: QueryCollection<T[P][]> } | |
} | |
class QueryCollection<T> { | |
components:T; | |
listen?: { | |
added?: (value:T) => void; | |
removed?: (value:T) => void; | |
} | |
} | |
type RenderSystemQuery = { | |
"sprites": [ Sprite, Transform ] | |
} | |
class RenderSystem extends System<RenderSystemQuery> { | |
constructor() { | |
super() | |
this.query.sprites.components.forEach(([sprite, tranform]) => { | |
}); | |
this.query.sprites.listen.added = ([Sprite, Transform]) => { | |
}; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment