Initial code for Animation stack

This commit is contained in:
Jacob Alexander 2016-01-03 23:45:13 -08:00
parent b30f8f5e97
commit ad1ea632e4
2 changed files with 113 additions and 2 deletions

View file

@ -44,7 +44,7 @@ typedef enum FrameState {
// * Add no-rollover
// * Subtract no-rollover
typedef enum PixelChange {
PixelChange_Set = 0, // <no op>
PixelChange_Set = 0, // =
PixelChange_Add, // +
PixelChange_Subtract, // -
PixelChange_NoRoll_Add, // +:
@ -54,6 +54,13 @@ typedef enum PixelChange {
} PixelChange;
// Animation modifiers
typedef enum AnimationModifier {
AnimationModifier_None = 0x00,
AnimationModifier_Fallthrough = 0x01, // Process lower animation first
} AnimationModifier;
// ----- Structs -----
@ -74,7 +81,7 @@ typedef struct PixelBuf {
typedef struct PixelElement {
uint8_t width; // Number of bits in a channel
uint8_t channels; // Number of channels
// Hardware indices for each channel
// Hardware indices for each channel
uint16_t indices[Pixel_MaxChannelPerPixel];
} PixelElement;
#define Pixel_RGBChannel(r,g,b) { 8, 3, { r, g, b } }
@ -89,6 +96,22 @@ typedef struct PixelMod {
uint8_t data[0]; // Data size depends on PixelElement definition
} PixelMod;
// Animation stack element
typedef struct AnimationElement {
uint16_t index; // Animation id
uint16_t pos; // Current frame
uint8_t loops; // # of loops to run animation, 0 indicates infinite
uint8_t divider; // # of times to repeat each frame
AnimationModifier modifier; // Modifier applied to the entire animation
} AnimationElement;
// Animation stack
#define Pixel_AnimationStackSize 16
typedef struct AnimationStack {
uint16_t size;
AnimationElement stack[Pixel_AnimationStackSize];
} AnimationStack;
// ----- Variables -----