summaryrefslogtreecommitdiff
path: root/src/systems/render.js
blob: 0a4c72d7abb2c3de89cb7f8e60abb5749de5ed30 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
game.system.Render = (graphics) => {
  const update = (elapsedTime, entities) => {
    graphics.clear();

    for (let id in entities) {
      const entity = entities[id];
      if (entity.sprite && entity.hasComponent("position") && entity.hasComponent("appearance")) {
        entity.sprite.draw(elapsedTime, {...entity.components.position, ...entity.components.appearance});
      }
    }
  }
  return { update };
};