|
|
@@ -12,6 +12,7 @@
|
|
|
#include "game/engine/game_dispatch.hpp"
|
|
|
#include "game/graphics/renderer.hpp"
|
|
|
#include "game/math/common.hpp"
|
|
|
+#include "game/math/compare.hpp"
|
|
|
|
|
|
using namespace engine;
|
|
|
|
|
|
@@ -20,6 +21,17 @@ scene::scene(std::string const & str, std::shared_ptr<game_dispatch> dispatch)
|
|
|
|
|
|
scene::~scene() {}
|
|
|
|
|
|
+bool scene::in_bounds(math::dim2::point p) const {
|
|
|
+ return math::between(p[0], 0.f, local_scene_dimension_[0]) &&
|
|
|
+ math::between(p[1], 0.f, local_scene_dimension_[1]);
|
|
|
+}
|
|
|
+
|
|
|
+bool scene::in_bounds(collidable * c) const {
|
|
|
+ auto & quad = c->render_info().points;
|
|
|
+ return in_bounds(quad.ll) || in_bounds(quad.lr) || in_bounds(quad.ur) ||
|
|
|
+ in_bounds(quad.ul);
|
|
|
+}
|
|
|
+
|
|
|
void scene::check_collisions(std::vector<collidable *> const & from,
|
|
|
std::vector<collidable *> const & to) {
|
|
|
for (auto & ent : from) {
|