pinball0.h 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  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. #define VERSION "v0.3"
  20. // Vertical orientation
  21. #define LCD_WIDTH 64
  22. #define LCD_HEIGHT 128
  23. typedef enum {
  24. EventTypeTick,
  25. EventTypeKey
  26. } EventType;
  27. typedef struct {
  28. EventType type;
  29. InputEvent input;
  30. } PinballEvent;
  31. typedef enum GameMode {
  32. GM_TableSelect,
  33. GM_Playing,
  34. GM_GameOver,
  35. GM_Error,
  36. GM_Settings,
  37. GM_About
  38. } GameMode;
  39. typedef struct PinballApp {
  40. ~PinballApp();
  41. FuriMutex* mutex;
  42. TableList table_list;
  43. GameMode game_mode;
  44. Table* table; // data for the current table
  45. uint32_t tick;
  46. bool gameStarted;
  47. bool keys[4]; // which key was pressed?
  48. bool processing; // controls game loop and game objects
  49. // user settings
  50. struct {
  51. bool sound_enabled;
  52. bool vibrate_enabled;
  53. bool led_enabled;
  54. bool debug_mode;
  55. } settings;
  56. int selected_setting;
  57. int max_settings;
  58. // system objects
  59. Storage* storage;
  60. NotificationApp* notify; // allows us to blink/buzz during game
  61. char text[256]; // general temp buffer
  62. } PinballApp;