main.c 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. #include <gui/view.h>
  2. #include <gui/modules/submenu.h>
  3. #include "../../main.h"
  4. #include "main.h"
  5. #include <demo_app_icons.h>
  6. #define THIS_SCENE About
  7. void About_on_draw(Canvas* canvas, void* context);
  8. AppAbout* About_alloc() {
  9. AppAbout* about = (AppAbout*)malloc(sizeof(AppAbout));
  10. about->view = view_alloc();
  11. view_set_draw_callback(about->view, About_on_draw);
  12. return about;
  13. }
  14. void About_on_draw(Canvas* canvas, void* context) {
  15. UNUSED(context);
  16. canvas_clear(canvas);
  17. canvas_set_bitmap_mode(canvas, true);
  18. canvas_draw_icon(canvas, 2, 3, &I_DolphinWait);
  19. canvas_set_font(canvas, FontPrimary);
  20. canvas_draw_str(canvas, 67, 11, "f0-template");
  21. canvas_set_font(canvas, FontSecondary);
  22. canvas_draw_str(canvas, 72, 20, "by Alex4386");
  23. canvas_draw_line(canvas, 68, 25, 124, 25);
  24. canvas_draw_str(canvas, 71, 39, "Protected by");
  25. canvas_set_font(canvas, FontPrimary);
  26. canvas_draw_str(canvas, 61, 51, "Fantasy Seal");
  27. canvas_draw_str(canvas, 69, 61, "Technology");
  28. }
  29. void About_free(void* ptr) {
  30. AppAbout* home = (AppAbout*)ptr;
  31. FURI_LOG_I("DemoApp", "Triggering Free for view");
  32. view_free(home->view);
  33. home->view = NULL;
  34. free(home);
  35. }
  36. View* About_get_view(void* ptr) {
  37. AppAbout* home = (AppAbout*)ptr;
  38. return home->view;
  39. }
  40. void About_on_enter(void* context) {
  41. App* app = (App*)context;
  42. view_dispatcher_switch_to_view(app->view_dispatcher, THIS_SCENE);
  43. }
  44. bool About_on_event(void* context, SceneManagerEvent event) {
  45. UNUSED(context);
  46. UNUSED(event);
  47. if(event.type == SceneManagerEventTypeBack) {
  48. return false;
  49. }
  50. return true;
  51. }
  52. void About_on_exit(void* context) {
  53. App* app = (App*)context;
  54. if(app == NULL) {
  55. return;
  56. }
  57. //if(app->view_dispatcher) view_dispatcher_switch_to_view(app->view_dispatcher, Home);
  58. //if(app->scene_manager) scene_manager_previous_scene(app->scene_manager);
  59. }