avr/animation/animation.h

32 lines
824 B
C
Raw Normal View History

2022-07-18 04:39:38 +00:00
#include <stdint.h>
2022-07-18 04:39:38 +00:00
#ifndef __ANIMATION_H__
#define __ANIMATION_H__
2022-07-18 04:39:38 +00:00
// line_t provides a simplified implementation of Bresenham's line drawing
// technique. At this time, it assumes a transition of x = 0 -> 60, and a dy
// between -59 and 59. I am not sure I understand Bresenham's algorithm yet,
// but I'll need to revisit all of this if I want to expand the boundaries.
2022-07-18 03:01:27 +00:00
typedef struct {
int y;
int de;
int error;
int inc;
int dt;
int dy;
int y0;
int y1;
2022-07-18 03:01:27 +00:00
} time_line_t;
// Construct a new line object. x1 must be greater than x0, and dy must be less than dx.
2022-07-18 03:01:27 +00:00
time_line_t time_line_new(int, int, int, int);
// Calculate the next y value of the line.
2022-07-18 03:01:27 +00:00
int time_line_next(time_line_t *);
// Diagnostic printout of the current state of line_t.
2022-07-18 04:39:38 +00:00
void time_line_print(time_line_t *);
#endif