Hello everyone,
I'm having some trouble getting pd->sprite->setClipRect to work. Basically, no matter what I set the values to in the LCDRect, the entirety of the sprite is removed (you can see in my commented line I tried setting it to the full screen, still hides the entire sprite). Any ideas what I might be overlooking?
Thanks in advance,
Jeebs
static void updateCigMeter(LCDSprite* cigMeter)
{
float x, y;
pd->sprite->getPosition(cigMeter, &x, &y);
int newY = y;
int newX = x;
LCDRect cigMeterClipRect = {newX - 39, newY - 6, 39, 11};
//LCDRect cigMeterClipRect = {0, 0, 400, 240};
pd->sprite->setClipRect(cigMeter, cigMeterClipRect);
}
static LCDSprite* createCigMeter(int xPos, int yPos)
{
LCDSprite *cigMeter = pd->sprite->newSprite();
pd->sprite->setUpdateFunction(cigMeter, updateCigMeter);
int w;
pd->graphics->getBitmapData(cigMeterImage, &w, &cigMeterImageHeight, NULL, NULL, NULL);
pd->sprite->setImage(cigMeter, cigMeterImage, kBitmapUnflipped);
pd->sprite->moveTo(cigMeter, xPos, yPos);
pd->sprite->setZIndex(cigMeter, 500);
pd->sprite->addSprite(cigMeter);
return cigMeter;
}