blackhat_scene.c 1.1 KB

1234567891011121314151617181920212223242526272829303132
  1. #include "blackhat_scene.h"
  2. // Generate scene on_enter handlers array
  3. #define ADD_SCENE(prefix, name, id) prefix##_scene_##name##_on_enter,
  4. void (*const blackhat_scene_on_enter_handlers[])(void*) = {
  5. #include "blackhat_scene_config.h"
  6. };
  7. #undef ADD_SCENE
  8. // Generate scene on_event handlers array
  9. #define ADD_SCENE(prefix, name, id) prefix##_scene_##name##_on_event,
  10. bool (*const blackhat_scene_on_event_handlers[])(
  11. void* context, SceneManagerEvent event
  12. ) = {
  13. #include "blackhat_scene_config.h"
  14. };
  15. #undef ADD_SCENE
  16. // Generate scene on_exit handlers array
  17. #define ADD_SCENE(prefix, name, id) prefix##_scene_##name##_on_exit,
  18. void (*const blackhat_scene_on_exit_handlers[])(void* context) = {
  19. #include "blackhat_scene_config.h"
  20. };
  21. #undef ADD_SCENE
  22. // Initialize scene handlers configuration structure
  23. const SceneManagerHandlers blackhat_scene_handlers = {
  24. .on_enter_handlers = blackhat_scene_on_enter_handlers,
  25. .on_event_handlers = blackhat_scene_on_event_handlers,
  26. .on_exit_handlers = blackhat_scene_on_exit_handlers,
  27. .scene_num = BlackhatSceneNum,
  28. };