Welcome to mirror list, hosted at ThFree Co, Russian Federation.

dolphin.c.tmpl « templates « assets « flipper « scripts - github.com/ClusterM/flipperzero-firmware.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 997b6447335ab20c98777f0a1fb52430d03ba5f7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
#include <assets_{{symbol_name}}.h>
#include <desktop/animations/animation_storage_i.h>
#include <desktop/animations/animation_manager.h>
#include <gui/icon_i.h>

{% for animation in animations: %}
{% for frame_number, frame in enumerate(animation.frames): %}
const uint8_t _A_{{ animation.name }}_{{ frame_number }}[] = {
    {{ "%s" % ",".join("0x%x" % i for i in frame)}}
};
{% :endfor %}

const uint8_t * const _A_{{animation.name}}[] = {
{% for frame_number, frame in enumerate(animation.frames): %}
    _A_{{ animation.name }}_{{ frame_number }},
{% :endfor %}
};

{% if animation.bubble_slots > 0: %}
{% for bubble in animation.bubbles: %}
const FrameBubble {{ animation.name }}_bubble_{{ bubble["Slot"] }}_{{ bubble["_BubbleIndex"] }};
{% :endfor %}

const FrameBubble* const {{animation.name}}_bubble_sequences[] = {
{% for i in range(animation.bubble_slots): %}
    &{{animation.name}}_bubble_{{i}}_0,
{% :endfor %}
};

{% for bubble in animation.bubbles: %}
{%
    if "_NextBubbleIndex" in bubble:
        next_bubble = f'&{animation.name}_bubble_{bubble["Slot"]}_{bubble["_NextBubbleIndex"]}'
    else:
        next_bubble = "NULL"
%}
const FrameBubble {{animation.name}}_bubble_{{bubble["Slot"]}}_{{bubble["_BubbleIndex"]}} = {
    .bubble = {
        .x = {{bubble["X"]}},
        .y = {{bubble["Y"]}},
        .text = "{{bubble["Text"]}}",
        .align_h = Align{{bubble["AlignH"]}},
        .align_v = Align{{bubble["AlignV"]}},
    },
    .start_frame = {{bubble["StartFrame"]}},
    .end_frame = {{bubble["EndFrame"]}},
    .next_bubble = {{next_bubble}},
};
{% :endfor %}
{% :endif %}

const uint8_t {{animation.name}}_frame_order[] = { {{ "%s" % ", ".join(str(i) for i in animation.meta['Frames order']) }} };

const BubbleAnimation BA_{{animation.name}} = {
    .icon_animation = {
        .width = {{ animation.meta['Width'] }},
        .height = {{ animation.meta['Height'] }},
        .frame_count = {{ "%d" % len(animation.frames) }},
        .frame_rate = {{ animation.meta['Frame rate'] }},
        .frames = _A_{{ animation.name }}
    },
    .frame_order = {{animation.name}}_frame_order,
    .passive_frames = {{ animation.meta['Passive frames'] }},
    .active_frames = {{ animation.meta['Active frames'] }},
    .active_cooldown = {{ animation.meta['Active cooldown'] }},
    .active_cycles = {{ animation.meta['Active cycles'] }},
    .duration = {{ animation.meta['Duration'] }},
{% if animation.bubble_slots > 0: %}
    .frame_bubble_sequences = {{ animation.name }}_bubble_sequences,
    .frame_bubble_sequences_count = COUNT_OF({{ animation.name }}_bubble_sequences),
{% :else: %}
    .frame_bubble_sequences = NULL,
    .frame_bubble_sequences_count = 0,
{% :endif %}
};
{% :endfor %}

const StorageAnimation {{symbol_name}}[] = {
{% for animation in animations: %}
    {
        .animation = &BA_{{animation.name}},
        .manifest_info = {
            .name = "{{animation.name}}",
            .min_butthurt = {{animation.min_butthurt}},
            .max_butthurt = {{animation.max_butthurt}},
            .min_level = {{animation.min_level}},
            .max_level = {{animation.max_level}},
            .weight = {{animation.weight}},
        }
    },
{% :endfor %}
};

const size_t {{symbol_name}}_size = COUNT_OF({{symbol_name}});