Touhou/include/animation.h

33 lines
1.1 KiB
C

#ifndef _ANIMATION_H
#define _ANIMATION_H
// Objects
typedef struct {
uint16_t x, y, r; // Position and radius
struct {
uint8_t enabled :1; // Object enabled (visible, updated)
uint8_t col_nor :1; // Collisions in normal mode
uint8_t col_foc :1; // Collisions in focused mode
uint8_t color :4; // Color. 3 bits used, maybe 4 in the future
uint8_t type :8; // Type of object. Linked to image_t
} meta;
} object_t;
// Animations
typedef struct animation_s animation_t;
typedef struct {
uint32_t timestamp; // Timestamp of the animation
uint32_t n_objects; // Number of objects
object_t *objects; // Table of object_t
void (*updater)(animation_t*, uint32_t); // Updater function
} animation_s;
// Utils
animation_t *new_animation(uint32_t objects, void (*updater)(animation_t*));
void del_animation(animation_t *animation);
// List of animation functions
void dummy_updater(animation_t *animation, uint32_t us_elapsed);
#endif // _ANIMATION_H