Skip to content

3.cSprite Function List

Aaron Liddiment edited this page Nov 10, 2015 · 14 revisions

###cSprite(uint8_t Width = 0, uint8_t Height = 0, const uint8_t *Data = NULL, uint8_t NumFrames = 0, SpriteNumBits_t BitsPixel = _1BIT, const struct CRGB *ColTable = NULL, const uint8_t *Mask = NULL);

###void Setup(uint8_t Width, uint8_t Height, const uint8_t *Data, uint8_t NumFrames, SpriteNumBits_t BitsPixel, const struct CRGB *ColTable, const uint8_t *Mask = NULL);

There are two ways to setup a Sprite, the first way is to do this when the variable is declared and the second is to call the Setup() function in your code. The parameters are the same for both methods.
Width & Height are the size of the sprite data in pixels/leds.
Data is a pointer to the bit packed sprite image data.
NumFrames is how many full sprite images are sequentially declared in the above data.
BitsPixel is the number of bits used in the image data per pixel/led and can be _1BIT, _2BIT, _3BIT & _4BIT.
ColTable is a pointer to an array of CRGB's. The size of the array is related to the BitsPixel above and should be 1, 3, 7 & 15.
Mask is a pointer to single bit data that can be used for collision detection.

###void Update();

###boolean Combine(int16_t dx, int16_t dy, cSprite *Src);

###void Render(cLEDMatrixBase *Matrix);

###void EdgeDetect(cLEDMatrixBase *Matrix);

###void SetPosition(int16_t X, int16_t Y);

###void SetFrame(uint8_t Frame, uint8_t FrameRate = 0);

###void SetMotion(int8_t XChange, uint8_t XRate, int8_t YChange, uint8_t YRate);

###void SetOptions(uint8_t Options);

###void SetPositionFrameMotionOptions(int16_t X, int16_t Y, uint8_t Frame, uint8_t FrameRate, int8_t XChange, uint8_t XRate, int8_t YChange, uint8_t YRate, uint8_t Options = 0);

###uint8_t GetFlags();

###uint8_t GetCurrentFrame();

###int8_t GetXChange();

###int8_t GetYChange();

###uint8_t GetXCounter();

###uint8_t GetYCounter();

###void SetXChange(int8_t XC);

###void SetYChange(int8_t YC);

###void SetXCounter(uint8_t Xcnt);

###void SetYCounter(uint8_t Ycnt);

###void IncreaseFrame();

###void DecreaseFrame();

Clone this wiki locally