void BiPlaneGameUI::addPlayerSpeedo(void) { // Get the ID Handling singlton MyIdHandler* mih = &MyIdHandler::get(); // Grab some ID's for the speedo and needle (one for the image, one for the sprite) this->speedoImageId = mih->getImageId(); this->speedoSpriteId = mih->getSpriteId(); this->speedoNeedleImageId = mih->getImageId(); this->speedoNeedleSpriteId = mih->getSpriteId(); // Load the resources dbLoadImage("Media/speedo.png", this->speedoImageId, 1); dbLoadImage("Media/needle.png", this->speedoNeedleImageId, 1); // Define the speedo sprite dbSprite(this->speedoSpriteId, 0, 0, this->speedoImageId); dbHideSprite(this->speedoSpriteId); dbSetSpriteAlpha(this->speedoSpriteId, 33); // Define the needle sprite, offsetting it's center so it pivots nicely dbSprite(this->speedoNeedleSpriteId, 0, 0, this->speedoNeedleImageId); dbHideSprite(this->speedoNeedleSpriteId); dbOffsetSprite(this->speedoNeedleSpriteId, 43, 12); dbSetSpriteAlpha(this->speedoNeedleSpriteId, 33); // Define the position of the speedo... this->speedoX = dbScreenWidth() - dbSpriteWidth(this->speedoSpriteId) - 16; this->speedoY = dbScreenHeight() - dbSpriteHeight(this->speedoSpriteId) - 16; // ... an the needle this->needleX = this->speedoX + (dbSpriteWidth(this->speedoSpriteId) / 2); this->needleY = this->speedoY + (dbSpriteHeight(this->speedoSpriteId) / 2); }
void Mobstacle::simuShow() { if(active == 1) { dbOffsetSprite( spriteNO , dbSpriteWidth(spriteNO)/2 , dbSpriteHeight(spriteNO)/2 ); dbRotateSprite( imageNO , angle ); dbSprite ( spriteNO , locationX * phyToReal , locationY * phyToReal , imageNO ); dbSetSpritePriority( spriteNO , 4); } }
bool MaudioButton::onSprite ( int pointX , int pointY ) { bool insideSprite; int upperX = dbSpriteX ( spriteNO ) - dbSpriteOffsetX ( spriteNO ); int upperY = dbSpriteY ( spriteNO ) - dbSpriteOffsetY ( spriteNO ); int lowerX = upperX + dbSpriteWidth ( spriteNO ); int lowerY = upperY + dbSpriteHeight ( spriteNO ); if ( pointX >= upperX && pointY >= upperY && pointX <= lowerX && pointY <= lowerY ) insideSprite = 1; else insideSprite = 0; return insideSprite; }
bool DBBitmapHelper::IsButtonClicked(int buttonID) { int mouseX = dbMouseX(); int mouseY = dbMouseY(); int width = dbSpriteWidth(buttonID); int height = dbSpriteHeight(buttonID); int x = dbSpriteX(buttonID); int y = dbSpriteY(buttonID); bool result = false; bool inButtonArea = false; if (mouseX > x && mouseX < (x + width)) { if (mouseY > y && mouseY < (y + height)) { inButtonArea = true; // The mouse is inside the button. // Now check for mouse clicks. if(dbMouseClick()==1) { //WindowsHelper::SetActiveCursor(LoadCursorFromFile("aero_arrow.cur")); return true; } } } if(inButtonArea) { WindowsHelper::SetActiveCursor(LoadCursorFromFile("aero_link.cur")); } //else //{ // WindowsHelper::SetActiveCursor(LoadCursorFromFile("aero_arrow.cur")); //} return false; }
void Ave::moveBird(){ dbSprite(ID,posx,posy,ID_Image); dbOffsetSprite(ID,dbSpriteWidth(ID)/2,dbSpriteHeight(ID)/2); dbSync(); }