summary refs log tree commit diff stats
path: root/src/system.h
blob: e630c485a6bf70dc693931f095582b6b3aa68e19 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
#ifndef SYSTEM_H_B61A8CEA
#define SYSTEM_H_B61A8CEA

#include "entity_manager.h"

class Game;
class Texture;

class System {
public:

  using id_type = EntityManager::id_type;

  System(Game& game) : game_(game)
  {
  }

  virtual ~System() = default;

  /**
   * Updates the state of a system.
   *
   * @param dt - The amount of time in seconds that have passed since the last
   *             update.
   */
  virtual void tick(double)
  {
  }

  /**
   * Renders to a texture.
   *
   * @param texture - The surface to render to.
   */
  virtual void render(Texture&)
  {
  }

  /**
   * Processes keyboard input.
   *
   * @param key - The relevant key.
   *
   * @param action - The action performed (press, released, etc).
   */
  virtual void input(int, int)
  {
  }

protected:

  Game& game_;
};

#endif /* end of include guard: SYSTEM_H_B61A8CEA */