bullet_pattern.hpp 949 B

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. //
  2. // bullet_pattern.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 <json/forwards.h>
  10. #include <memory>
  11. namespace objects { namespace prototype {
  12. template <typename, typename...> class factory;
  13. }}
  14. namespace graphics {
  15. class manager;
  16. }
  17. namespace danmaku {
  18. class actor;
  19. struct bullet_timer {
  20. float const interval;
  21. float remaining{0.f};
  22. };
  23. struct bullet_pattern {
  24. virtual ~bullet_pattern() = default;
  25. virtual void update(float delta) = 0;
  26. };
  27. using bullet_pattern_factory =
  28. objects::prototype::factory<std::shared_ptr<bullet_pattern>, actor *,
  29. Json::Value const &,
  30. graphics::manager const &>;
  31. }
  32. #define BIND_BULLET_PATTERN(name, function) \
  33. bool const _ = bullet_pattern_factory::instance().bind(name, function)