From 8158e9c732c75baf47e51c304ab593f9feb842c6 Mon Sep 17 00:00:00 2001 From: Alec Thomas Date: Mon, 27 Oct 2014 10:26:30 +1100 Subject: Configurable delta time type via -DENTITYX_DT_TYPE=. Fixes #60. --- examples/example.cc | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'examples') 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 { // Updates a body's position and rotation. struct BodySystem : public ex::System { - 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(dt); @@ -99,7 +99,7 @@ struct BodySystem : public ex::System { // 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 { - 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 { 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 { 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(*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(dt); systems.update(dt); systems.update(dt); -- cgit v1.2.3