flipchess_scene_scene_1.c 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. #include "../flipchess.h"
  2. #include "../helpers/flipchess_custom_event.h"
  3. #include "../views/flipchess_scene_1.h"
  4. void flipchess_scene_1_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_scene_1_on_enter(void* context) {
  10. furi_assert(context);
  11. FlipChess* app = context;
  12. flipchess_scene_1_set_callback(app->flipchess_scene_1, flipchess_scene_1_callback, app);
  13. view_dispatcher_switch_to_view(app->view_dispatcher, FlipChessViewIdScene1);
  14. }
  15. bool flipchess_scene_scene_1_on_event(void* context, SceneManagerEvent event) {
  16. FlipChess* app = context;
  17. bool consumed = false;
  18. if(event.type == SceneManagerEventTypeCustom) {
  19. switch(event.event) {
  20. case FlipChessCustomEventScene1Left:
  21. case FlipChessCustomEventScene1Right:
  22. break;
  23. case FlipChessCustomEventScene1Up:
  24. case FlipChessCustomEventScene1Down:
  25. break;
  26. case FlipChessCustomEventScene1Back:
  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, FlipChessSceneMenu)) {
  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 flipchess_scene_scene_1_on_exit(void* context) {
  42. FlipChess* app = context;
  43. UNUSED(app);
  44. }