Animation.h
Go to the documentation of this file.
1 // SPDX-License-Identifier: Beerware
2 /**
3  * @file Animation.h
4  * @brief Tamago animation handler
5  */
6 #pragma once
7 
8 #include <stdbool.h>
9 #include <stdint.h>
10 
11 #define FRAME_SIZE 64 ///< Frame size in byte
12 #define NUM_OF_FRAMES 167 ///< Total number of frames
13 
14 /**
15  * @enum AnimID
16  * @brief Animation IDs
17  */
18 typedef enum
19 {
20  IDLE_EGG = 0, ///< ID, Egg idle animation
21  HATCH_EGG, ///< ID, Babytchi idle animation
22  IDLE_BABYTCHI, ///< ID, Babytchi idle animation
23  IDLE_MARUTCHI, ///< ID, Marutchi idle animation
24  IDLE_TAMATCHI, ///< ID, Tamatchi idle animation
25  IDLE_KUCHITAMATCHI, ///< ID, Kuchitamatchi idle animation
26  IDLE_MAMETCHI, ///< ID, Mametchi idle animation
27  IDLE_GINJIROTCHI, ///< ID, Ginjirotchi idle animation
28  IDLE_MASKUTCHI, ///< ID, Maskutchi idle animation
29  IDLE_KUCHIPATCHI, ///< ID, Kuchipatchi idle animation
30  IDLE_NYOROTCHI, ///< ID, Nyorotchi idle animation
31  IDLE_TARAKOTCHI, ///< ID, Tarakotchi idle animation
32  IDLE_OYAJITCHI, ///< ID, Oyajotchi idle animation
33  IDLE_OBAKETCHI, ///< ID, Obaketchi idle animation
34  NUM_OF_ANIMATIONS ///< Total number of animations
35 
36 } AnimID;
37 
38 /**
39  * @enum IconID
40  * @brief Icon IDs
41  */
42 typedef enum
43 {
44  ICON_POO = 0, ///< ID, Poo icon
45  ICON_SKULL, ///< ID, Skull icon
46  ICON_SLEEP ///< ID, Sleep icon
47 
48 } IconID;
49 
50 /**
51  * @struct Animation
52  * @brief Animation
53  */
54 typedef struct
55 {
56  uint16_t u16Offset; ///< Frame offset in byte
57  uint8_t u8Length; ///< Animation length/number of frames
58 
59 } Animation;
60 
61 void Animation_Init(void);
62 uint8_t* Animation_GetBufferAddr(void);
63 void Animation_ShowIcon(IconID eID, bool bShow);
64 void Animation_Set(AnimID eID);
65 void Animation_Update(void);
@ IDLE_GINJIROTCHI
ID, Ginjirotchi idle animation.
Definition: Animation.h:27
@ HATCH_EGG
ID, Babytchi idle animation.
Definition: Animation.h:21
@ IDLE_OBAKETCHI
ID, Obaketchi idle animation.
Definition: Animation.h:33
void Animation_Set(AnimID eID)
Set current animation.
Definition: Animation.c:3068
@ IDLE_MARUTCHI
ID, Marutchi idle animation.
Definition: Animation.h:23
uint8_t u8Length
Animation length/number of frames.
Definition: Animation.h:57
@ IDLE_KUCHITAMATCHI
ID, Kuchitamatchi idle animation.
Definition: Animation.h:25
@ ICON_SLEEP
ID, Sleep icon.
Definition: Animation.h:46
void Animation_Update(void)
Update animation buffer.
Definition: Animation.c:3076
void Animation_ShowIcon(IconID eID, bool bShow)
Show (or hide) icon.
Definition: Animation.c:3048
@ ICON_SKULL
ID, Skull icon.
Definition: Animation.h:45
@ IDLE_EGG
ID, Egg idle animation.
Definition: Animation.h:20
@ IDLE_MAMETCHI
ID, Mametchi idle animation.
Definition: Animation.h:26
@ IDLE_TARAKOTCHI
ID, Tarakotchi idle animation.
Definition: Animation.h:31
uint8_t * Animation_GetBufferAddr(void)
Get address of image buffer.
Definition: Animation.c:3036
Animation.
Definition: Animation.h:54
@ NUM_OF_ANIMATIONS
Total number of animations.
Definition: Animation.h:34
@ IDLE_MASKUTCHI
ID, Maskutchi idle animation.
Definition: Animation.h:28
@ IDLE_BABYTCHI
ID, Babytchi idle animation.
Definition: Animation.h:22
IconID
Icon IDs.
Definition: Animation.h:42
@ IDLE_KUCHIPATCHI
ID, Kuchipatchi idle animation.
Definition: Animation.h:29
@ IDLE_TAMATCHI
ID, Tamatchi idle animation.
Definition: Animation.h:24
uint16_t u16Offset
Frame offset in byte.
Definition: Animation.h:56
void Animation_Init(void)
Initialise animation handler.
Definition: Animation.c:2988
AnimID
Animation IDs.
Definition: Animation.h:18
@ IDLE_OYAJITCHI
ID, Oyajotchi idle animation.
Definition: Animation.h:32
@ IDLE_NYOROTCHI
ID, Nyorotchi idle animation.
Definition: Animation.h:30
@ ICON_POO
ID, Poo icon.
Definition: Animation.h:44