actor.hpp 870 B

123456789101112131415161718192021222324252627282930313233343536
  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. virtual ~actor() = default;
  20. virtual void update(float delta) = 0;
  21. virtual void level(class level *) = 0;
  22. virtual class level * level() const = 0;
  23. };
  24. using actor_factory =
  25. objects::prototype::factory<std::unique_ptr<actor>, Json::Value const &,
  26. graphics::manager const &>;
  27. }
  28. #define BIND_ACTOR(name, function) \
  29. bool const _ = actor_factory::instance().bind(name, function)