weebo_scene_start.c 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. #include "../weebo_i.h"
  2. enum SubmenuIndex {
  3. SubmenuIndexSamPresent,
  4. SubmenuIndexSamMissing,
  5. };
  6. static void weebo_scene_start_detect_callback(void* context) {
  7. Weebo* weebo = context;
  8. UNUSED(weebo);
  9. // view_dispatcher_send_custom_event(weebo->view_dispatcher, WeeboWorkerEventSamMissing);
  10. }
  11. void weebo_scene_start_submenu_callback(void* context, uint32_t index) {
  12. Weebo* weebo = context;
  13. view_dispatcher_send_custom_event(weebo->view_dispatcher, index);
  14. }
  15. void weebo_scene_start_on_enter(void* context) {
  16. Weebo* weebo = context;
  17. Popup* popup = weebo->popup;
  18. popup_set_context(weebo->popup, weebo);
  19. popup_set_callback(weebo->popup, weebo_scene_start_detect_callback);
  20. popup_set_header(popup, "Detecting SAM", 58, 48, AlignCenter, AlignCenter);
  21. popup_set_timeout(weebo->popup, 2500);
  22. popup_enable_timeout(weebo->popup);
  23. view_dispatcher_switch_to_view(weebo->view_dispatcher, WeeboViewPopup);
  24. }
  25. bool weebo_scene_start_on_event(void* context, SceneManagerEvent event) {
  26. Weebo* weebo = context;
  27. bool consumed = false;
  28. if(event.type == SceneManagerEventTypeCustom) {
  29. scene_manager_set_scene_state(weebo->scene_manager, WeeboSceneStart, event.event);
  30. /*
  31. if(event.event == WeeboWorkerEventSamPresent) {
  32. scene_manager_next_scene(weebo->scene_manager, WeeboSceneSamPresent);
  33. consumed = true;
  34. } else if(event.event == WeeboWorkerEventSamMissing) {
  35. scene_manager_next_scene(weebo->scene_manager, WeeboSceneSamMissing);
  36. consumed = true;
  37. } else if(event.event == WeeboWorkerEventSamWrong) {
  38. scene_manager_next_scene(weebo->scene_manager, WeeboSceneSamWrong);
  39. consumed = true;
  40. }
  41. */
  42. }
  43. return consumed;
  44. }
  45. void weebo_scene_start_on_exit(void* context) {
  46. Weebo* weebo = context;
  47. popup_reset(weebo->popup);
  48. }