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.
tobspr_shapez.io/src/js/game/game_system.js

44 lines
939 B

/* typehints:start */
import { GameRoot } from "./root";
import { DrawParameters } from "../core/draw_parameters";
/* typehints:end */
/**
* A game system processes all entities which match a given schema, usually a list of
* required components. This is the core of the game logic.
*/
export class GameSystem {
/**
* @param {GameRoot} root
*/
constructor(root) {
this.root = root;
}
///// PUBLIC API /////
/**
* Updates the game system, override to perform logic
*/
update() {}
/**
* Override, do not call this directly, use startDraw()
* @param {DrawParameters} parameters
*/
draw(parameters) {}
/**
* Should refresh all caches
*/
refreshCaches() {}
/**
* @see GameSystem.draw Wrapper arround the draw method
* @param {DrawParameters} parameters
*/
startDraw(parameters) {
this.draw(parameters);
}
}