84410c83b5
* Desktop: cleanup headers * Get loader pubsub via record * [FL-2183] Dolphin refactoring 2022.01 * Restruct animations assets structure * Rename assets * Cleanup headers * Update Recording animation * Add BadBattery animation * Provide loader's pubsub via record * Fix load/unload animations * Scripts: add flipper format support, initial dolphin packager rework. Assets: internal and external dolphin. * Sync internal meta.txt and manifest.txt * Reorder, rename dolphin assets * Split essential generated assets * Add ReadMe for dolphin assets * Separate essential blocking animations * Scripts: full dolphin validation before packaging * Assets, Scripts: dolphin external resources packer * Github: update codeowners * Scripts: proper slots handling in dolphin animation meta * Scripts: correct frames enumeration and fix compiled assets. * [FL-2209] Add Dolphin Deeds points and many more * Remove excess frame_rate * Change dolphin assets directory * Scripts: add internal resource support to dolphin compiler * Scripts: add internal assets generation, renaming * Scripts: correct assert, renaming * Code cleanup, documentation, fixes * Update Levelup animations * Rename essential -> blocking * Fix Unlocked hint * Scripts: rewrite Templite compiller, replace regexps with token parser, split block types into code and variable blocks. Update dolphin templates. * Documentation: add key combos description and use information * Scripts: cleanup templit, more debug info and add dev comment Co-authored-by: あく <alleteam@gmail.com>
153 lines
4.1 KiB
C
153 lines
4.1 KiB
C
#pragma once
|
|
|
|
#include <gui/view.h>
|
|
#include <gui/icon_i.h>
|
|
#include <stdint.h>
|
|
#include <dolphin/dolphin.h>
|
|
|
|
typedef struct AnimationManager AnimationManager;
|
|
|
|
typedef struct {
|
|
uint8_t x;
|
|
uint8_t y;
|
|
const char* text;
|
|
Align align_h;
|
|
Align align_v;
|
|
} Bubble;
|
|
|
|
typedef struct FrameBubble {
|
|
Bubble bubble;
|
|
uint8_t start_frame;
|
|
uint8_t end_frame;
|
|
const struct FrameBubble* next_bubble;
|
|
} FrameBubble;
|
|
|
|
typedef struct {
|
|
const FrameBubble* const* frame_bubble_sequences;
|
|
uint8_t frame_bubble_sequences_count;
|
|
const Icon icon_animation;
|
|
uint8_t frame_order[20];
|
|
uint8_t passive_frames;
|
|
uint8_t active_frames;
|
|
uint8_t active_cycles;
|
|
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);
|