flipperzero-firmware/applications/desktop/helpers/desktop_animation.h
Albert Kharisov 9b8a139e2b
[FL-1995] New dolphin animations (part 1) (#835)
* Desktop Animation (part 1): Ugly naked ohmygod architecture
* fix butthurt, fix locked scene
* Change SD icons, fixes
* Fix level update animation
* Fixes, correct butthurt
* Clean up code
* furi_assert(0) -> furi_crash("msg")
* Gui: rename none layer to desktop, update docs.

Co-authored-by: あく <alleteam@gmail.com>
2021-11-24 19:21:12 +03:00

56 lines
1.5 KiB
C

#pragma once
#include <stdint.h>
#include <gui/icon.h>
typedef struct DesktopAnimation DesktopAnimation;
typedef struct ActiveAnimation ActiveAnimation;
typedef struct BasicAnimation BasicAnimation;
typedef enum {
DesktopAnimationStateBasic,
DesktopAnimationStateActive,
DesktopAnimationStateLevelUpIsPending,
DesktopAnimationStateSDEmpty,
DesktopAnimationStateSDEmptyURL,
DesktopAnimationStateSDCorrupted,
} DesktopAnimationState;
struct BasicAnimation {
const Icon* icon;
uint16_t duration; // sec
uint16_t active_cooldown;
uint8_t weight;
uint16_t butthurt_level_mask;
};
struct ActiveAnimation {
const Icon* icon;
uint16_t duration; // sec
};
typedef struct {
const BasicAnimation* basic;
const ActiveAnimation* active;
} PairedAnimation;
typedef void (*AnimationChangedCallback)(void*);
DesktopAnimation* desktop_animation_alloc(void);
void desktop_animation_free(DesktopAnimation*);
void desktop_animation_activate(DesktopAnimation* instance);
void desktop_animation_set_animation_changed_callback(
DesktopAnimation* instance,
AnimationChangedCallback callback,
void* context);
DesktopAnimationState desktop_animation_handle_right(DesktopAnimation* animation);
void desktop_animation_start_oneshot_levelup(DesktopAnimation* animation);
const Icon* desktop_animation_get_animation(DesktopAnimation* animation);
const Icon* desktop_animation_get_oneshot_frame(DesktopAnimation* animation);
void desktop_start_new_idle_animation(DesktopAnimation* animation);