|
@@ -16,14 +16,24 @@
|
|
|
#include "game/util/identity.hpp"
|
|
#include "game/util/identity.hpp"
|
|
|
|
|
|
|
|
namespace engine {
|
|
namespace engine {
|
|
|
- class entity : identity<entity> {
|
|
|
|
|
|
|
+ class collidable : identity<collidable> {
|
|
|
|
|
+ public:
|
|
|
|
|
+ collidable(graphics::object const & obj);
|
|
|
|
|
+ collidable(Json::Value const & json, graphics::manager const & mgr);
|
|
|
|
|
+
|
|
|
|
|
+ virtual void collide(collidable const &) {}
|
|
|
|
|
+ graphics::object const & render_info() const { return render_info_; }
|
|
|
|
|
+
|
|
|
|
|
+ protected:
|
|
|
|
|
+ // A mix of position and graphics info
|
|
|
|
|
+ graphics::object render_info_;
|
|
|
|
|
+ };
|
|
|
|
|
+
|
|
|
|
|
+ class entity : public collidable {
|
|
|
public:
|
|
public:
|
|
|
// TODO: Extract this out?
|
|
// TODO: Extract this out?
|
|
|
entity(Json::Value const & json, graphics::manager const & mgr);
|
|
entity(Json::Value const & json, graphics::manager const & mgr);
|
|
|
void update(float delta);
|
|
void update(float delta);
|
|
|
- void collide(entity const &);
|
|
|
|
|
-
|
|
|
|
|
- graphics::object const & render_info() const { return render_info_; }
|
|
|
|
|
|
|
|
|
|
private:
|
|
private:
|
|
|
// The scene that owns this object
|
|
// The scene that owns this object
|
|
@@ -34,8 +44,6 @@ namespace engine {
|
|
|
math::vec2 velocity;
|
|
math::vec2 velocity;
|
|
|
math::vec2 acceleration{{0, 0}};
|
|
math::vec2 acceleration{{0, 0}};
|
|
|
float angular_velocity{0.f};
|
|
float angular_velocity{0.f};
|
|
|
- // A mix of position and graphics info
|
|
|
|
|
- graphics::object render_info_;
|
|
|
|
|
// Graphics info
|
|
// Graphics info
|
|
|
std::size_t frame_index{0};
|
|
std::size_t frame_index{0};
|
|
|
std::vector<math::vec2> frame_texture_coords;
|
|
std::vector<math::vec2> frame_texture_coords;
|