flipchess_scene_startscreen.c 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. #include "../flipchess.h"
  2. #include "../helpers/flipchess_custom_event.h"
  3. #include "../views/flipchess_startscreen.h"
  4. void flipchess_scene_startscreen_callback(FlipChessCustomEvent event, void* context) {
  5. furi_assert(context);
  6. FlipChess* app = context;
  7. view_dispatcher_send_custom_event(app->view_dispatcher, event);
  8. }
  9. void flipchess_scene_startscreen_on_enter(void* context) {
  10. furi_assert(context);
  11. FlipChess* app = context;
  12. flipchess_startscreen_set_callback(
  13. app->flipchess_startscreen, flipchess_scene_startscreen_callback, app);
  14. view_dispatcher_switch_to_view(app->view_dispatcher, FlipChessViewIdStartscreen);
  15. }
  16. bool flipchess_scene_startscreen_on_event(void* context, SceneManagerEvent event) {
  17. FlipChess* app = context;
  18. bool consumed = false;
  19. if(event.type == SceneManagerEventTypeCustom) {
  20. switch(event.event) {
  21. case FlipChessCustomEventStartscreenLeft:
  22. case FlipChessCustomEventStartscreenRight:
  23. break;
  24. case FlipChessCustomEventStartscreenUp:
  25. case FlipChessCustomEventStartscreenDown:
  26. break;
  27. case FlipChessCustomEventStartscreenOk:
  28. scene_manager_next_scene(app->scene_manager, FlipChessSceneMenu);
  29. consumed = true;
  30. break;
  31. case FlipChessCustomEventStartscreenBack:
  32. notification_message(app->notification, &sequence_reset_red);
  33. notification_message(app->notification, &sequence_reset_green);
  34. notification_message(app->notification, &sequence_reset_blue);
  35. if(!scene_manager_search_and_switch_to_previous_scene(
  36. app->scene_manager, FlipChessSceneStartscreen)) {
  37. scene_manager_stop(app->scene_manager);
  38. view_dispatcher_stop(app->view_dispatcher);
  39. }
  40. consumed = true;
  41. break;
  42. }
  43. }
  44. return consumed;
  45. }
  46. void flipchess_scene_startscreen_on_exit(void* context) {
  47. FlipChess* app = context;
  48. UNUSED(app);
  49. }