aboutsummaryrefslogtreecommitdiffstats
path: root/examples
diff options
context:
space:
mode:
authorAlec Thomas <alec@swapoff.org>2014-10-27 10:26:30 +1100
committerAlec Thomas <alec@swapoff.org>2014-10-27 10:26:57 +1100
commit8158e9c732c75baf47e51c304ab593f9feb842c6 (patch)
treeae92c64f8faf104694c86c3384ab64504ad1babf /examples
parentff13e11e706c377f767e61b781c63c99c8f665eb (diff)
Configurable delta time type via -DENTITYX_DT_TYPE=<type>.
Fixes #60.
Diffstat (limited to 'examples')
-rw-r--r--examples/example.cc14
1 files changed, 7 insertions, 7 deletions
diff --git a/examples/example.cc b/examples/example.cc
index cf00a8b..29ca68a 100644
--- a/examples/example.cc
+++ b/examples/example.cc
@@ -86,7 +86,7 @@ struct CollisionEvent : public ex::Event<CollisionEvent> {
// Updates a body's position and rotation.
struct BodySystem : public ex::System<BodySystem> {
- void update(ex::EntityManager &es, ex::EventManager &events, double dt) override {
+ void update(ex::EntityManager &es, ex::EventManager &events, DeltaTime dt) override {
Body::Handle body;
for (ex::Entity entity : es.entities_with_components(body)) {
body->position += body->direction * static_cast<float>(dt);
@@ -99,7 +99,7 @@ struct BodySystem : public ex::System<BodySystem> {
// Fades out the alpha value of any Renderable and Fadeable entity. Once the
// object has completely faded out it is destroyed.
struct FadeOutSystem : public ex::System<FadeOutSystem> {
- void update(ex::EntityManager &es, ex::EventManager &events, double dt) override {
+ void update(ex::EntityManager &es, ex::EventManager &events, DeltaTime dt) override {
Fadeable::Handle fade;
Renderable::Handle renderable;
for (ex::Entity entity : es.entities_with_components(fade, renderable)) {
@@ -121,7 +121,7 @@ class BounceSystem : public ex::System<BounceSystem> {
public:
explicit BounceSystem(sf::RenderTarget &target) : size(target.getSize()) {}
- void update(ex::EntityManager &es, ex::EventManager &events, double dt) override {
+ void update(ex::EntityManager &es, ex::EventManager &events, DeltaTime dt) override {
Body::Handle body;
for (ex::Entity entity : es.entities_with_components(body)) {
if (body->position.x + body->direction.x < 0 ||
@@ -159,7 +159,7 @@ class CollisionSystem : public ex::System<CollisionSystem> {
size.y = size.y / PARTITIONS + 1;
}
- void update(ex::EntityManager &es, ex::EventManager &events, double dt) override {
+ void update(ex::EntityManager &es, ex::EventManager &events, DeltaTime dt) override {
reset();
collect(es);
collide(events);
@@ -226,7 +226,7 @@ public:
events.subscribe<CollisionEvent>(*this);
}
- void update(ex::EntityManager &es, ex::EventManager &events, double dt) override {
+ void update(ex::EntityManager &es, ex::EventManager &events, DeltaTime dt) override {
for (ex::Entity entity : collided) {
emit_particles(es, entity);
entity.destroy();
@@ -285,7 +285,7 @@ public:
text.setColor(sf::Color::White);
}
- void update(ex::EntityManager &es, ex::EventManager &events, double dt) override {
+ void update(ex::EntityManager &es, ex::EventManager &events, DeltaTime dt) override {
Body::Handle body;
Renderable::Handle renderable;
for (ex::Entity entity : es.entities_with_components(body, renderable)) {
@@ -341,7 +341,7 @@ public:
}
}
- void update(double dt) {
+ void update(DeltaTime dt) {
systems.update<BodySystem>(dt);
systems.update<FadeOutSystem>(dt);
systems.update<BounceSystem>(dt);