8. Larger Patterns

Some functions for handling larger patterns.

<<funcdefs>>=
void kuf_set_block(int width,
                   uint16_t *squares,
                   int xpos, int ypos,
                   uint16_t w, uint16_t x,
                   uint16_t y, uint16_t z);
<<funcs>>=
void kuf_set_block(int width,
                   uint16_t *squares,
                   int xpos, int ypos,
                   uint16_t w, uint16_t x,
                   uint16_t y, uint16_t z)
{
    int start;

    start = ypos * width + xpos;

    squares[start] = w;
    squares[start + 1] = x;

    start += width;
    squares[start] = y;
    squares[start + 1] = z;
}
<<funcdefs>>=
void kuf_set_square(int width,
                    uint16_t *squares,
                    int xpos, int ypos,
                    uint16_t s);
<<funcs>>=
void kuf_set_square(int width,
                    uint16_t *squares,
                    int xpos, int ypos,
                    uint16_t s)
{
    squares[ypos * width + xpos] = s;
}



prev | home | next