Browse Source

fixed framebuffer bugs

feature/2015
Christian Kroll 14 years ago
parent
commit
09d120b9a8
  1. 6
      animations/fpmath_patterns.c
  2. 9
      animations/gameoflife.c

6
animations/fpmath_patterns.c

@ -45,9 +45,9 @@ static double dist(double x1, double y1, double x2, double y2)
* Draws an animated two dimensional graph for a given function f(x,y,t).
* @param t_start start value for the function's time variable
* @param t_stop stop value for the function's time variable
* @param t_delta value by which the functions timing variable gets incremented
* @param t_delta value by which the function's timing variable gets incremented
* @param frame_delay frame delay in ms
* @param fpPattern function which generates a pattern depending x, y, t
* @param fpPattern function which generates a pattern depending on x, y, t
*/
static void fpmath_pattern(double const t_start,
double const t_stop,
@ -68,7 +68,7 @@ static void fpmath_pattern(double const t_start,
unsigned char color = fpPattern(x, y, t);
for (uint8_t p = NUMPLANE; p--;)
{
if (p == (color - 1))
if (p <= (color - 1))
{
BUFFER[p][y][x / 8] |= shl_table[x % 8U];
}

9
animations/gameoflife.c

@ -59,7 +59,7 @@
#define LOOP_DETECT_BUFFER_SIZE 8U
#ifndef GOL_DELAY
#define GOL_DELAY 1 /* milliseconds */
#define GOL_DELAY 100 /* milliseconds */
#endif
#ifndef GOL_CYCLES
@ -170,8 +170,10 @@ void nextiteration(field_t dest, field_t src) {
/******************************************************************************/
#ifdef BITSTUFFED
static void pfprint(field_t pf) {
memcpy(pixmap[NUMPLANE - 1], pf, sizeof(field_t));
void pfprint(field_t pf) {
for (uint8_t i = NUMPLANE; i--;) {
memcpy(pixmap[i], pf, sizeof(field_t));
}
}
#else
void pfprint(field_t pf) {
@ -292,7 +294,6 @@ void gameoflife() {
/* the main part */
pfprint(pf1);
for (cycle = 1; cycle < GOL_CYCLES; ++cycle) {
wait(100);
DEBUG_BYTE(0, (uint8_t)(GOL_CYCLES-cycle) & 0xff); DEBUG_BYTE(1, SREG);
wait(GOL_DELAY);
pfcopy(pf2, pf1);

Loading…
Cancel
Save