bubble_animation_view.h 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. #pragma once
  2. #include <gui/view.h>
  3. #include "../animation_manager.h"
  4. /** Bubble Animation instance */
  5. typedef struct BubbleAnimationView BubbleAnimationView;
  6. /** Callback type to be called when interact button pressed */
  7. typedef void (*BubbleAnimationInteractCallback)(void*);
  8. /**
  9. * Allocate bubble animation view.
  10. * This is animation with bubbles, and 2 phases:
  11. * active and passive.
  12. *
  13. * @return instance of new bubble animation
  14. */
  15. BubbleAnimationView* bubble_animation_view_alloc(void);
  16. /**
  17. * Free bubble animation view.
  18. *
  19. * @view bubble animation view instance
  20. */
  21. void bubble_animation_view_free(BubbleAnimationView* view);
  22. /**
  23. * Set callback for interact action for animation.
  24. * Currently this is right button.
  25. *
  26. * @view bubble animation view instance
  27. * @callback callback to call when button pressed
  28. * @context context
  29. */
  30. void bubble_animation_view_set_interact_callback(
  31. BubbleAnimationView* view,
  32. BubbleAnimationInteractCallback callback,
  33. void* context);
  34. /**
  35. * Set new animation.
  36. * BubbleAnimation doesn't posses Bubble Animation object
  37. * so it doesn't handle any memory manipulation on Bubble Animations.
  38. *
  39. * @view bubble animation view instance
  40. * @new_bubble_animation new animation to set
  41. */
  42. void bubble_animation_view_set_animation(
  43. BubbleAnimationView* view,
  44. const BubbleAnimation* new_bubble_animation);
  45. /**
  46. * Get view of bubble animation.
  47. *
  48. * @view bubble animation view instance
  49. * @return view
  50. */
  51. View* bubble_animation_get_view(BubbleAnimationView* view);
  52. /**
  53. * Freeze current playing animation. Saves a frame to be shown
  54. * during next unfreeze called.
  55. * bubble_animation_freeze() stops any reference to 'current' animation
  56. * so it can be freed. Therefore lock unfreeze should be preceeded with
  57. * new animation set.
  58. *
  59. * Freeze/Unfreeze usage example:
  60. *
  61. * animation_view_alloc()
  62. * set_animation()
  63. * ...
  64. * freeze_animation()
  65. * // release animation
  66. * ...
  67. * // allocate animation
  68. * set_animation()
  69. * unfreeze()
  70. *
  71. * @view bubble animation view instance
  72. */
  73. void bubble_animation_freeze(BubbleAnimationView* view);
  74. /**
  75. * Starts bubble animation after freezing.
  76. *
  77. * @view bubble animation view instance
  78. */
  79. void bubble_animation_unfreeze(BubbleAnimationView* view);