input_event.c 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. #include "input_event.h"
  2. void cycle_focus(FlizzerTrackerApp* tracker)
  3. {
  4. switch(tracker->mode)
  5. {
  6. case PATTERN_VIEW:
  7. {
  8. tracker->focus++;
  9. if(tracker->focus > EDIT_SONGINFO)
  10. {
  11. tracker->focus = EDIT_PATTERN;
  12. }
  13. }
  14. default: break;
  15. }
  16. }
  17. void process_input_event(FlizzerTrackerApp* tracker, FlizzerTrackerEvent* event)
  18. {
  19. /*if(event->input.key == InputKeyBack && event->input.type == InputTypeShort && event->period > 0 && event->period < 200)
  20. {
  21. cycle_focus(tracker);
  22. }*/
  23. if(event->input.key == InputKeyBack && event->input.type == InputTypeShort && !(tracker->editing))
  24. {
  25. cycle_focus(tracker);
  26. return;
  27. }
  28. // Если нажата кнопка "назад", то выходим из цикла, а следовательно и из приложения
  29. if(event->input.key == InputKeyBack && event->input.type == InputTypeLong)
  30. {
  31. tracker->quit = true;
  32. return;
  33. }
  34. switch(tracker->focus)
  35. {
  36. case EDIT_PATTERN:
  37. {
  38. pattern_edit_event(tracker, event);
  39. break;
  40. }
  41. case EDIT_SEQUENCE:
  42. {
  43. sequence_edit_event(tracker, event);
  44. break;
  45. }
  46. case EDIT_SONGINFO:
  47. {
  48. songinfo_edit_event(tracker, event);
  49. break;
  50. }
  51. default: break;
  52. }
  53. }