|
|
@@ -11,6 +11,7 @@
|
|
|
#include "game/engine/events.hpp"
|
|
|
#include "game/engine/game_dispatch.hpp"
|
|
|
#include "game/graphics/renderer.hpp"
|
|
|
+#include "game/math/common.hpp"
|
|
|
|
|
|
namespace engine {
|
|
|
|
|
|
@@ -20,6 +21,17 @@ namespace engine {
|
|
|
for (auto & ent : entities) {
|
|
|
ent.update(delta);
|
|
|
}
|
|
|
+ for (auto & pair : colliders) {
|
|
|
+ auto & collidable = collidables[pair.first];
|
|
|
+ for (auto & ent : pair.second) {
|
|
|
+ for (auto & hit : collidable) {
|
|
|
+ if (math::intersects(ent->render_info().points,
|
|
|
+ hit->render_info().points)) {
|
|
|
+ ent->collide(*hit);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
void scene::render() {
|