// Private "render" function for the speedo void BiPlaneGameUI::drawSpeedo(void) { // TODO: Why am I pasting the sprites?! // Display the speedo dbPasteSprite(this->speedoSpriteId, this->speedoX, this->speedoY); // Display the needle // TODO: Un-hardcode speedo half-width (128) dbPasteSprite(this->speedoNeedleSpriteId, this->needleX, this->needleY); }
void world::updateWorld(int xInputCord, int yInputCord) { //Updates the positions for the current stage / level. if(strcmp(currentworld,"stage1") == 0) { dbPasteImage(2,80,0); dbPasteImage(6,130,36); dbPasteImage(14,95,265); dbPasteImage(11,243,400,1); dbPasteImage(12,325,400,1); dbPasteImage(13,93,375,1); dbPasteImage(7,193,29); dbPasteSprite(1, xInputCord, yInputCord); } }
void world::dimArea(char interval[], void *classPointer) { int timeInterval = atoi(interval); int *currentXCord = static_cast<world*>(classPointer)->currentX; //Get our x coordinate from our class int *currentYCord = static_cast<world*>(classPointer)->currentY; //Get our y coordinate from our class int numberOfSpritesPlus1 = (static_cast<world*>(classPointer)->numOfSprites)+1; int numberOfImagesPlus1 = (static_cast<world*>(classPointer)->numOfImages)+1; dbSyncOn ( ); dbSyncRate ( 60 ); dbLoadImage("background.png",numberOfImagesPlus1); dbSprite(numberOfSpritesPlus1,0,0,numberOfImagesPlus1); dbPlaySound(3); for(int i = 0; i < 255 && LoopGDK(); i+=5) { //Make our screen slightly darker each time. The speed is controlled by the timeInterval variable. static_cast<world*>(classPointer)->updateWorld(*currentXCord,*currentYCord); dbSetSpriteAlpha(numberOfSpritesPlus1,i); dbPasteSprite(numberOfSpritesPlus1,0,0); dbWait(timeInterval); dbSync(); } for(int i = 0; i <= 100 && LoopGDK(); i+=5) { //Keep out screen dark for a little bit static_cast<world*>(classPointer)->updateWorld(*currentXCord,*currentYCord); dbWait(timeInterval); dbSync(); } for(int i = 255; i >= 0 && LoopGDK(); i-=5) { //Now make our screen lighter so we can see again. static_cast<world*>(classPointer)->updateWorld(*currentXCord,*currentYCord); dbSetSpriteAlpha(numberOfSpritesPlus1,i); dbPasteSprite(numberOfSpritesPlus1,0,0); dbWait(timeInterval); dbSync(); } }