 a39002ce22
			
		
	
	
		a39002ce22
		
			
		
	
	
	
	
		
			
			* Dolphin Animation Refactoring, part 1 * Remove animations from desktop * Remove excess, first start * Split animation_manager with callbacks * allocate view inside animation_view * Work on ViewComposed * Draw white rectangles under bubble corners * Fix bubbles sequence * RPC: remove obsolete include "status.pb.h" * Add animations manifest decoding * Flipper file: add strict mode * FFF: Animation structures parsing * Assembling structure of animation * Lot of view fixes: Add multi-line bubbles Add support for passive bubbles (frame_order values starts from passive now) Add hard-coded delay (active_shift) for active state enabling Fix active state handling Fix leaks Fix parsing uncorrect bubble_animation meta file Fix bubble rules of showing * Animation load/unload & view freeze/unfreeze * Blocking & system animations, fixes: View correct activation Refactoring + blocking animation Freeze first passive/active frames Many insert/eject SD tests fixes Add system animations Add Loader events app started/finished Add system no_sd animation * Assets: dolphin packer. Scripts: minor refactoring. * Desktop: update logging tags. Scripts: add metadata to dolphin bundling process, extra sorting for fs traversing. Make: phony assets rules. * Github: rebuild assets on build * Docker: add missing dependencies for assets compilation * Docker: fix run command syntax * ReadMe: update naming rules with link to source * Assets: recompile icons * Loader: add loader event * Desktop, Gui, Furi Core: const shenanigans macros Co-authored-by: Aleksandr Kutuzov <alleteam@gmail.com>
		
			
				
	
	
		
			152 lines
		
	
	
		
			4.1 KiB
		
	
	
	
		
			C
		
	
	
	
	
	
			
		
		
	
	
			152 lines
		
	
	
		
			4.1 KiB
		
	
	
	
		
			C
		
	
	
	
	
	
| #pragma once
 | |
| 
 | |
| #include "dolphin/dolphin.h"
 | |
| #include <gui/view.h>
 | |
| #include <stdint.h>
 | |
| 
 | |
| typedef struct AnimationManager AnimationManager;
 | |
| 
 | |
| typedef struct {
 | |
|     uint8_t x;
 | |
|     uint8_t y;
 | |
|     const char* str;
 | |
|     Align horizontal;
 | |
|     Align vertical;
 | |
| } Bubble;
 | |
| 
 | |
| typedef struct FrameBubble {
 | |
|     Bubble bubble;
 | |
|     uint8_t starts_at_frame;
 | |
|     uint8_t ends_at_frame;
 | |
|     struct FrameBubble* next_bubble;
 | |
| } FrameBubble;
 | |
| 
 | |
| typedef struct {
 | |
|     FrameBubble** frame_bubbles;
 | |
|     uint8_t frame_bubbles_count;
 | |
|     const Icon** icons;
 | |
|     uint8_t passive_frames;
 | |
|     uint8_t active_frames;
 | |
|     uint8_t active_cycles;
 | |
|     uint8_t frame_rate;
 | |
|     uint16_t duration;
 | |
|     uint16_t active_cooldown;
 | |
| } BubbleAnimation;
 | |
| 
 | |
| typedef void (*AnimationManagerSetNewIdleAnimationCallback)(void* context);
 | |
| typedef void (*AnimationManagerCheckBlockingCallback)(void* context);
 | |
| typedef void (*AnimationManagerInteractCallback)(void*);
 | |
| 
 | |
| /**
 | |
|  * Allocate Animation Manager
 | |
|  *
 | |
|  * @return animation manager instance
 | |
|  */
 | |
| AnimationManager* animation_manager_alloc(void);
 | |
| 
 | |
| /**
 | |
|  * Free Animation Manager
 | |
|  *
 | |
|  * @animation_manager   instance
 | |
|  */
 | |
| void animation_manager_free(AnimationManager* animation_manager);
 | |
| 
 | |
| /**
 | |
|  * Get View of Animation Manager
 | |
|  *
 | |
|  * @animation_manager   instance
 | |
|  * @return      view
 | |
|  */
 | |
| View* animation_manager_get_animation_view(AnimationManager* animation_manager);
 | |
| 
 | |
| /**
 | |
|  * Set context for all callbacks for Animation Manager
 | |
|  *
 | |
|  * @animation_manager   instance
 | |
|  * @context             context
 | |
|  */
 | |
| void animation_manager_set_context(AnimationManager* animation_manager, void* context);
 | |
| 
 | |
| /**
 | |
|  * Set callback for Animation Manager for defered calls
 | |
|  * for animation_manager_new_idle_process().
 | |
|  * Animation Manager doesn't have it's own thread, so main thread gives
 | |
|  * callbacks to A.M. to call when it should perform some inner manipulations.
 | |
|  * This callback is called from other threads and should notify main thread
 | |
|  * when to call animation_manager_new_idle_process().
 | |
|  * So scheme is this:
 | |
|  * A.M. sets callbacks,
 | |
|  * callbacks notifies main thread
 | |
|  * main thread in its own context calls appropriate *_process() function.
 | |
|  *
 | |
|  * @animation_manager   instance
 | |
|  * @callback            callback
 | |
|  */
 | |
| void animation_manager_set_new_idle_callback(
 | |
|     AnimationManager* animation_manager,
 | |
|     AnimationManagerSetNewIdleAnimationCallback callback);
 | |
| 
 | |
| /**
 | |
|  * Function to call in main thread as a response to
 | |
|  * set_new_idle_callback's call.
 | |
|  *
 | |
|  * @animation_manager   instance
 | |
|  */
 | |
| void animation_manager_new_idle_process(AnimationManager* animation_manager);
 | |
| 
 | |
| /**
 | |
|  * Set callback for Animation Manager for defered calls
 | |
|  * for animation_manager_check_blocking_process().
 | |
|  *
 | |
|  * @animation_manager   instance
 | |
|  * @callback            callback
 | |
|  */
 | |
| void animation_manager_set_check_callback(
 | |
|     AnimationManager* animation_manager,
 | |
|     AnimationManagerCheckBlockingCallback callback);
 | |
| 
 | |
| /**
 | |
|  * Function to call in main thread as a response to
 | |
|  * set_new_idle_callback's call.
 | |
|  *
 | |
|  * @animation_manager   instance
 | |
|  */
 | |
| void animation_manager_check_blocking_process(AnimationManager* animation_manager);
 | |
| 
 | |
| /**
 | |
|  * Set callback for Animation Manager for defered calls
 | |
|  * for animation_manager_interact_process().
 | |
|  *
 | |
|  * @animation_manager   instance
 | |
|  * @callback            callback
 | |
|  */
 | |
| void animation_manager_set_interact_callback(
 | |
|     AnimationManager* animation_manager,
 | |
|     AnimationManagerInteractCallback callback);
 | |
| 
 | |
| /**
 | |
|  * Function to call in main thread as a response to
 | |
|  * set_new_idle_callback's call.
 | |
|  *
 | |
|  * @animation_manager   instance
 | |
|  */
 | |
| void animation_manager_interact_process(AnimationManager* animation_manager);
 | |
| 
 | |
| /**
 | |
|  * Unload and Stall animation actions. Draw callback in view
 | |
|  * paints first frame of current animation until
 | |
|  * animation_manager_load_and_continue_animation() is called.
 | |
|  * Can't be called multiple times. Every Stall has to be finished
 | |
|  * with Continue.
 | |
|  *
 | |
|  * @animation_manager   instance
 | |
|  */
 | |
| void animation_manager_unload_and_stall_animation(AnimationManager* animation_manager);
 | |
| 
 | |
| /**
 | |
|  * Load and Contunue execution of animation manager.
 | |
|  *
 | |
|  * @animation_manager   instance
 | |
|  */
 | |
| void animation_manager_load_and_continue_animation(AnimationManager* animation_manager);
 |