Sprite \ Libraries \ Wiring 1.0 (ALPHA)

| Index

| Reference for Wiring 1.0 (ALPHA) 0017+. If you have a previous version, use the reference included with your software. If you see any errors or have any comments, let us know.

Name |  | ### Sprite
Examples |  |
    #include <Binary.h>
    #include <Sprite.h>
    #include <Matrix.h>

    Matrix myMatrix = Matrix(0, 2, 1);

    /* create a new Sprite instance
       8 pixels wide, 4 pixels tall
    */
    Sprite wave = Sprite(
      8, 4,
      b00011000,
      b00100100,
      b01000010,
      b10000001
    );

    void setup()
    {
    }

    int x = 0;

    void loop()
    {
      myMatrix.write(x, 2, wave);     // place sprite on screen
      myMatrix.write(x - 8, 2, wave); // place sprite again, elsewhere on screen
      delay(75);                      // wait a little bit
      myMatrix.clear();               // clear the screen for next animation frame
      if(x == 8)                      // if reached end of animation sequence
      {
        x = 0;                        // start from beginning
      }
      x++;                            // advance x coordinate to the right
    }
Description |  | The Sprite library allows for creating image sprites to be used with the Matrix library.
Syntax |  |
    Sprite(width, height)
    Sprite(width, height, row1, row2, ...)
Parameters |  |
width |  | The width in pixels of the sprite
height |  | The height in pixels of the sprite
row1, row1, ... |  | The pixel rows specified in binary notation. Pixle values are set as 0 or 1's.
Methods |  |
width() |  |
height() |  |
write() |  |
read() |  |
Returns |  | None
Usage |  | Application