actor.hpp 903 B

12345678910111213141516171819202122232425262728293031323334353637
  1. //
  2. // actor.hpp
  3. // danmaku
  4. //
  5. // Created by Sam Jaffe on 5/26/19.
  6. // Copyright © 2019 Sam Jaffe. All rights reserved.
  7. //
  8. #pragma once
  9. #include "game/engine/entity.hpp"
  10. namespace objects { namespace prototype {
  11. template <typename, typename...> class factory;
  12. }}
  13. namespace graphics {
  14. class manager;
  15. }
  16. namespace danmaku {
  17. class level;
  18. struct actor : public engine::entity {
  19. using engine::entity::entity;
  20. virtual ~actor() = default;
  21. virtual void update(float delta) = 0;
  22. virtual void level(class level *) = 0;
  23. virtual class level * level() const = 0;
  24. };
  25. using actor_factory =
  26. objects::prototype::factory<std::unique_ptr<actor>, Json::Value const &,
  27. graphics::object const &>;
  28. }
  29. #define BIND_ACTOR(name, function) \
  30. bool const _ = actor_factory::instance().bind(name, function)