gb_cartridge_scene_scene_2.c 1.9 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(app->gb_cartridge_scene_2, gb_cartridge_scene_2_callback, app);
  13. view_dispatcher_switch_to_view(app->view_dispatcher, GBCartridgeViewIdScene2);
  14. }
  15. bool gb_cartridge_scene_scene_2_on_event(void* context, SceneManagerEvent event) {
  16. GBCartridge* app = context;
  17. bool consumed = false;
  18. if(event.type == SceneManagerEventTypeCustom) {
  19. switch(event.event) {
  20. case GBCartridgeCustomEventScene2Left:
  21. case GBCartridgeCustomEventScene2Right:
  22. break;
  23. case GBCartridgeCustomEventScene2Up:
  24. case GBCartridgeCustomEventScene2Down:
  25. break;
  26. case GBCartridgeCustomEventScene2Back:
  27. notification_message(app->notification, &sequence_reset_red);
  28. notification_message(app->notification, &sequence_reset_green);
  29. notification_message(app->notification, &sequence_reset_blue);
  30. if(!scene_manager_search_and_switch_to_previous_scene(
  31. app->scene_manager, GBCartridgeSceneMenu)) {
  32. scene_manager_stop(app->scene_manager);
  33. view_dispatcher_stop(app->view_dispatcher);
  34. }
  35. consumed = true;
  36. break;
  37. }
  38. }
  39. return consumed;
  40. }
  41. void gb_cartridge_scene_scene_2_on_exit(void* context) {
  42. GBCartridge* app = context;
  43. UNUSED(app);
  44. }