entity.hpp 897 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. //
  2. // entity.hpp
  3. // engine
  4. //
  5. // Created by Sam Jaffe on 5/20/19.
  6. // Copyright © 2019 Sam Jaffe. All rights reserved.
  7. //
  8. #pragma once
  9. #include <json/forwards.h>
  10. #include "game/engine/engine_fwd.hpp"
  11. #include "game/graphics/object.hpp"
  12. #include "game/util/identity.hpp"
  13. namespace engine {
  14. class scene;
  15. class entity : identity<entity> {
  16. public:
  17. entity(Json::Value const & json);
  18. void update(tick const & tk);
  19. private:
  20. // The scene that owns this object
  21. std::weak_ptr<scene> in_scene;
  22. // Position info
  23. math::vec2 last_position;
  24. math::vec2 velocity;
  25. math::vec2 acceleration;
  26. float angular_velocity;
  27. // A mix of position and graphics info
  28. graphics::object render_info;
  29. // Graphics info
  30. std::size_t frame_index;
  31. std::vector<math::vec2> frame_texture_coords;
  32. float scale;
  33. int collides_with;
  34. int collides_as;
  35. };
  36. }