Updates a body's position and rotation.
| 123 | |
| 124 | // Updates a body's position and rotation. |
| 125 | struct BodySystem : public ex::System<BodySystem> { |
| 126 | void update(ex::EntityManager &es, ex::EventManager &events, ex::TimeDelta dt) override { |
| 127 | ex::ComponentHandle<Body> body; |
| 128 | for (ex::Entity entity : es.entities_with_components(body)) { |
| 129 | body->position += body->direction * static_cast<float>(dt); |
| 130 | body->rotation += body->rotationd * dt; |
| 131 | } |
| 132 | }; |
| 133 | }; |
| 134 | |
| 135 | |
| 136 | // Bounce bodies off the edge of the screen. |
nothing calls this directly
no outgoing calls
no test coverage detected