bullet_pattern.hpp 815 B

123456789101112131415161718192021222324252627282930313233343536
  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 danmaku {
  15. class actor;
  16. struct bullet_timer {
  17. float const interval;
  18. float remaining{0.f};
  19. };
  20. struct bullet_pattern {
  21. virtual ~bullet_pattern() = default;
  22. virtual void update(float delta) = 0;
  23. };
  24. using bullet_pattern_factory = objects::prototype::factory<
  25. std::shared_ptr<bullet_pattern>, actor*, Json::Value const &>;
  26. }
  27. #define BIND_BULLET_PATTERN(name, function) \
  28. bool const _ = bullet_pattern_factory::instance().bind(name, function) \