diff options
author | Alec Thomas <alec@swapoff.org> | 2014-10-27 10:26:30 +1100 |
---|---|---|
committer | Alec Thomas <alec@swapoff.org> | 2014-10-27 10:26:57 +1100 |
commit | 8158e9c732c75baf47e51c304ab593f9feb842c6 (patch) | |
tree | ae92c64f8faf104694c86c3384ab64504ad1babf /README.md | |
parent | ff13e11e706c377f767e61b781c63c99c8f665eb (diff) |
Configurable delta time type via -DENTITYX_DT_TYPE=<type>.
Fixes #60.
Diffstat (limited to 'README.md')
-rw-r--r-- | README.md | 9 |
1 files changed, 5 insertions, 4 deletions
@@ -185,7 +185,7 @@ A basic movement system might be implemented with something like the following: ```c++ struct MovementSystem : public System<MovementSystem> { - void update(entityx::EntityManager &es, entityx::EventManager &events, double dt) override { + void update(entityx::EntityManager &es, entityx::EventManager &events, DeltaTime dt) override { Position::Handle position; Direction::Handle direction; for (Entity entity : es.entities_with_components(position, direction)) { @@ -222,7 +222,7 @@ Next we implement our collision system, which emits ``Collision`` objects via an ```c++ class CollisionSystem : public System<CollisionSystem> { public: - void update(entityx::EntityManager &es, entityx::EventManager &events, double dt) override { + void update(entityx::EntityManager &es, entityx::EventManager &events, DeltaTime dt) override { Position::Handle left_position, right_position; for (Entity left_entity : es.entities_with_components(left_position)) { for (Entity right_entity : es.entities_with_components(right_position)) { @@ -245,7 +245,7 @@ struct DebugSystem : public System<DebugSystem>, Receiver<DebugSystem> { event_manager.subscribe<Collision>(*this); } - void update(entityx::EntityManager &entities, entityx::EventManager &events, double dt) {} + void update(entityx::EntityManager &entities, entityx::EventManager &events, DeltaTime dt) {} void receive(const Collision &collision) { LOG(DEBUG) << "entities collided: " << collision.left << " and " << collision.right << endl; @@ -301,7 +301,7 @@ public: } } - void update(double dt) { + void update(DeltaTime dt) { systems.update<DebugSystem>(dt); systems.update<MovementSystem>(dt); systems.update<CollisionSystem>(dt); @@ -374,6 +374,7 @@ Once these dependencies are installed you should be able to build and install En - `-DENTITYX_MAX_COMPONENTS=64` - Override the maximum number of components that can be assigned to each entity. - `-DENTITYX_BUILD_SHARED=1` - Whether to build shared libraries (defaults to 1). - `-DENTITYX_BUILD_TESTING=1` - Whether to build tests (defaults to 0). Run with "make && make test". +- `-DENTITYX_DT_TYPE=double` - The type used for delta time in EntityX update methods. Once you have selected your flags, build and install with: |