pokemon_app.h 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. #ifndef POKEMON_APP_H
  2. #define POKEMON_APP_H
  3. #pragma once
  4. #include <furi.h>
  5. #include <furi_hal_light.h>
  6. #include <gui/gui.h>
  7. #include <gui/view.h>
  8. #include <gui/view_dispatcher.h>
  9. #include <gui/icon.h>
  10. #include <pokemon_icons.h>
  11. #include "views/select_pokemon.hpp"
  12. #include "views/trade.hpp"
  13. #define TAG "Pokemon"
  14. struct pokemon_lut {
  15. const char* name;
  16. const Icon* icon;
  17. const uint8_t hex;
  18. };
  19. typedef struct App App;
  20. typedef enum {
  21. GAMEBOY_INITIAL,
  22. GAMEBOY_READY,
  23. GAMEBOY_WAITING,
  24. GAMEBOY_TRADE_READY,
  25. GAMEBOY_SEND,
  26. GAMEBOY_PENDING,
  27. GAMEBOY_TRADING
  28. } render_gameboy_state_t;
  29. struct App {
  30. Gui* gui;
  31. ViewDispatcher* view_dispatcher;
  32. SelectPokemon* select_pokemon;
  33. Trade* trade;
  34. uint32_t view_id;
  35. int current_pokemon = 0;
  36. char pokemon_hex_code = ' ';
  37. };
  38. typedef enum {
  39. AppViewSelectPokemon,
  40. AppViewTrade,
  41. AppViewExitConfirm,
  42. } AppView;
  43. typedef void (*SelectPokemonCallback)(void* context, uint32_t index);
  44. typedef struct SelectPokemonModel {
  45. int current_pokemon = 0;
  46. char pokemon_hex_code = ' ';
  47. bool trading = false;
  48. bool connected = false;
  49. render_gameboy_state_t gameboy_status = GAMEBOY_INITIAL;
  50. SelectPokemonCallback callback;
  51. void* callback_context;
  52. } SelectPokemonModel;
  53. extern struct pokemon_lut pokemon_table[];
  54. #endif /* POKEMON_APP_H */