bullet_pattern.hpp 848 B

12345678910111213141516171819202122232425262728293031323334353637
  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 =
  25. objects::prototype::factory<std::shared_ptr<bullet_pattern>, actor *,
  26. Json::Value const &>;
  27. }
  28. #define BIND_BULLET_PATTERN(name, function) \
  29. bool const _ = bullet_pattern_factory::instance().bind(name, function)\