pinball0.h 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. #pragma once
  2. #include <gui/gui.h>
  3. // #include <input/input.h>
  4. #include <stdlib.h>
  5. #include <stdbool.h>
  6. #include <string.h>
  7. #include <cmath>
  8. // #include <furi_hal_resources.h>
  9. // #include <furi_hal_gpio.h>
  10. #include <dolphin/dolphin.h>
  11. #include <storage/storage.h>
  12. #include <notification/notification.h>
  13. #include <notification/notification_messages.h>
  14. #include "vec2.h"
  15. #include "objects.h"
  16. #include "table.h"
  17. // #define DRAW_NORMALS
  18. #define TAG "Pinball0"
  19. // Vertical orientation
  20. #define LCD_WIDTH 64
  21. #define LCD_HEIGHT 128
  22. typedef enum {
  23. EventTypeTick,
  24. EventTypeKey
  25. } EventType;
  26. typedef struct {
  27. EventType type;
  28. InputEvent input;
  29. } PinballEvent;
  30. typedef enum GameMode {
  31. GM_TableSelect,
  32. GM_Playing,
  33. GM_GameOver,
  34. GM_Error,
  35. GM_Settings,
  36. GM_About
  37. } GameMode;
  38. typedef struct {
  39. FuriMutex* mutex;
  40. TableList table_list;
  41. GameMode game_mode;
  42. Table* table; // data for the current table
  43. uint32_t tick;
  44. bool gameStarted;
  45. bool keys[4]; // which key was pressed?
  46. bool processing; // controls game loop and physics threads
  47. // user settings
  48. struct {
  49. bool sound_enabled;
  50. bool vibrate_enabled;
  51. bool led_enabled;
  52. bool manual_mode;
  53. } settings;
  54. int selected_setting;
  55. int max_settings;
  56. // system objects
  57. Storage* storage;
  58. NotificationApp* notify; // allows us to blink/buzz during game
  59. char text[256]; // general temp buffer
  60. } PinballApp;