MCPcopy Create free account
hub / github.com/alecthomas/entityx / BodySystem

Class BodySystem

examples/example.cc:125–133  ·  view source on GitHub ↗

Updates a body's position and rotation.

Source from the content-addressed store, hash-verified

123
124// Updates a body's position and rotation.
125struct 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.

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected