| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748 |
- //
- // entity.hpp
- // engine
- //
- // Created by Sam Jaffe on 5/20/19.
- // Copyright © 2019 Sam Jaffe. All rights reserved.
- //
- #pragma once
- #include <json/forwards.h>
- #include "game/engine/engine_fwd.hpp"
- #include "game/graphics/graphics_fwd.h"
- #include "game/graphics/object.hpp"
- #include "game/util/identity.hpp"
- namespace engine {
- class entity : identity<entity> {
- public:
- // TODO: Extract this out?
- entity(Json::Value const & json, graphics::manager const & mgr);
- void update(float delta);
- void collide(entity const &);
- graphics::object const & render_info() const { return render_info_; }
- private:
- // The scene that owns this object
- std::weak_ptr<scene> in_scene;
- // Position info
- math::vec2 last_position;
- math::vec2 velocity;
- math::vec2 acceleration;
- float angular_velocity;
- // A mix of position and graphics info
- graphics::object render_info_;
- // Graphics info
- std::size_t frame_index;
- std::vector<math::vec2> frame_texture_coords;
- float scale;
- collision_t collides_with;
- collision_t collides_as;
- };
- }
|