gb_cartridge_scene_scene_2.c 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. #include "../gb_cartridge_app.h"
  2. #include "../helpers/gb_cartridge_custom_event.h"
  3. #include "../views/gb_cartridge_scene_2.h"
  4. void gb_cartridge_scene_2_callback(GBCartridgeCustomEvent event, void* context) {
  5. furi_assert(context);
  6. GBCartridge* app = context;
  7. view_dispatcher_send_custom_event(app->view_dispatcher, event);
  8. }
  9. void gb_cartridge_scene_scene_2_on_enter(void* context) {
  10. furi_assert(context);
  11. GBCartridge* app = context;
  12. gb_cartridge_scene_2_set_callback(
  13. app->gb_cartridge_scene_2, gb_cartridge_scene_2_callback, app);
  14. view_dispatcher_switch_to_view(app->view_dispatcher, GBCartridgeViewIdScene2);
  15. }
  16. bool gb_cartridge_scene_scene_2_on_event(void* context, SceneManagerEvent event) {
  17. GBCartridge* app = context;
  18. bool consumed = false;
  19. if(event.type == SceneManagerEventTypeCustom) {
  20. switch(event.event) {
  21. case GBCartridgeCustomEventScene2Left:
  22. case GBCartridgeCustomEventScene2Right:
  23. break;
  24. case GBCartridgeCustomEventScene2Up:
  25. case GBCartridgeCustomEventScene2Down:
  26. break;
  27. case GBCartridgeCustomEventScene2Back:
  28. notification_message(app->notification, &sequence_reset_red);
  29. notification_message(app->notification, &sequence_reset_green);
  30. notification_message(app->notification, &sequence_reset_blue);
  31. if(!scene_manager_search_and_switch_to_previous_scene(
  32. app->scene_manager, GBCartridgeSceneMenu)) {
  33. scene_manager_stop(app->scene_manager);
  34. view_dispatcher_stop(app->view_dispatcher);
  35. }
  36. consumed = true;
  37. break;
  38. }
  39. }
  40. return consumed;
  41. }
  42. void gb_cartridge_scene_scene_2_on_exit(void* context) {
  43. GBCartridge* app = context;
  44. UNUSED(app);
  45. }