void Demo4Object::Draw() { // Do not draw if it should not be visible if ( !IsVisible() ) return; // int iSize = 25; int iTick = m_pMainEngine->GetTime()/20; // 1 per 20ms int iFrame = iTick % 30; int iSize = 10 + iFrame; if ( iFrame > 15 ) iSize = 10 + (30-iFrame); m_pMainEngine->DrawScreenOval( m_iCurrentScreenX - iSize, m_iCurrentScreenY - iSize, m_iCurrentScreenX + iSize-1, m_iCurrentScreenY + iSize-1, 0x00ffff ); // Store the position at which the object was last drawn // You MUST do this to ensure that the screen is updated when only drawing movable objects // This tells the system where to 'undraw' the object from StoreLastScreenPositionAndUpdateRect(); }
void PacmanEnemy::Draw() { if (!IsVisible()) return; int colour; if (m_pMainEngine->IsInPowerupState()) { if (m_pMainEngine->GetPowerupRemaining() < 2000) if (m_pMainEngine->GetModifiedTime() % 500 > 250) colour = 0xffffff; else colour = 0xff00ff; else colour = 0xff00ff; } else colour = 0x00ffff; m_pMainEngine->DrawScreenOval( m_iCurrentScreenX - m_iDrawWidth / 2, m_iCurrentScreenY - m_iDrawHeight / 2, m_iCurrentScreenX + m_iDrawWidth / 2, m_iCurrentScreenY + m_iDrawHeight / 2, colour); StoreLastScreenPositionAndUpdateRect(); }
void Sky::Draw() { skyBg->RenderImage(GetEngine()->GetBackground(), 0, 0, m_iCurrentScreenX, m_iCurrentScreenY, skyBg->GetWidth(), skyBg->GetHeight()); StoreLastScreenPositionAndUpdateRect(); }
// Draw the object - override to implement the actual drawing of the correct object // This just draws a magenta square at the current location void DisplayableObject::Draw() { // Draw the object for ( int iX = m_iCurrentScreenX + m_iStartDrawPosX ; iX < (m_iCurrentScreenX + m_iStartDrawPosX + m_iDrawWidth) ; iX++ ) for ( int iY = m_iCurrentScreenY + m_iStartDrawPosY ; iY < (m_iCurrentScreenY + m_iStartDrawPosY + m_iDrawHeight) ; iY++ ) m_pEngine->SafeSetScreenPixel( iX, iY, 0xff00ff ); // Store the position at which the object was last drawn. StoreLastScreenPositionAndUpdateRect(); }
void Jet::Draw() { if (!IsVisible()) return; jet->RenderImage(GetEngine()->GetForeground(), 0, 0, m_iCurrentScreenX, m_iCurrentScreenY, jet->GetWidth(), jet->GetHeight()); StoreLastScreenPositionAndUpdateRect(); }
void demoObject::Draw(void) { GetEngine()->DrawScreenRectangle( m_iCurrentScreenX, m_iCurrentScreenY, m_iCurrentScreenX + m_iDrawWidth -1, m_iCurrentScreenY + m_iDrawHeight -1, 0x00ff00 ); // This will store the position at which the object was drawn // so that the background can be drawn over the top. // This will then remove the object from the screen. StoreLastScreenPositionAndUpdateRect(); }
void GameMainObject::Draw(void) { if(!IsVisible()) { return; } image.RenderImageWithMask(m_pEngine->GetForeground(),m_iPlayerSpriteX,m_iPlayerSpriteY,m_iCurrentScreenX+m_iStartDrawPosX,m_iCurrentScreenY+m_iStartDrawPosY,121,120); StoreLastScreenPositionAndUpdateRect(); }
void NormalEnemy::Draw(void) { if (!readyToDelete()) { ImageData x; x.LoadImage("Images/Enemy/Enemy.png"); x.RenderImageWithMask( GetEngine()->GetForeground(),0,0, m_iCurrentScreenX, m_iCurrentScreenY, x.GetWidth(), x.GetHeight() ); m_iDrawHeight = m_iDrawWidth = x.GetWidth(); StoreLastScreenPositionAndUpdateRect(); } }
/** Draw the player object. Could be a simple shape but this makes a fake ball shape and labels it. */ void BouncingBall::Draw() { // Do not draw if it should not be visible if ( !IsVisible() ) return; unsigned int uiColourMult = 0x010001; unsigned int uiColourText = 0xffffff; // Choose one of 8 colours: switch( m_iColour % 8 ) { case 1: uiColourMult = 0x010000; uiColourText = 0xffffff; break; case 2: uiColourMult = 0x000100; uiColourText = 0xffffff; break; case 3: uiColourMult = 0x000001; uiColourText = 0xffffff; break; case 4: uiColourMult = 0x010001; uiColourText = 0; break; case 5: uiColourMult = 0x010100; uiColourText = 0; break; case 6: uiColourMult = 0x000101; uiColourText = 0; break; case 7: uiColourMult = 0x010101; uiColourText = 0; break; default: uiColourMult = 0x000000; break; } // Concentric circles for pseudo-sphere int iRadiusSquared = (m_iDrawWidth/2) * (m_iDrawWidth/2); int iCentreX = m_iCurrentScreenX + m_iStartDrawPosX + m_iDrawWidth/2; int iCentreY = m_iCurrentScreenY + m_iStartDrawPosY + m_iDrawHeight/2; for ( int iX = m_iCurrentScreenX + m_iStartDrawPosX ; iX < (m_iCurrentScreenX + m_iStartDrawPosX + m_iDrawWidth) ; iX++ ) for ( int iY = m_iCurrentScreenY + m_iStartDrawPosY ; iY < (m_iCurrentScreenY + m_iStartDrawPosY + m_iDrawHeight) ; iY++ ) if ( ( (iX-iCentreX)*(iX-iCentreX) + (iY-iCentreY)*(iY-iCentreY) ) <= iRadiusSquared ) { // 0xB0 is the range of values, 0xff is the brightest value. unsigned int uiColour = (0xB0 * ((iX-iCentreX)*(iX-iCentreX) + (iY-iCentreY)*(iY-iCentreY))) / iRadiusSquared; uiColour = 0xff - uiColour; GetEngine()->SafeSetScreenPixel( iX, iY, uiColourMult * uiColour ); } // If there is a label then draw the text if ( (m_szLabel!=NULL) && (strlen(m_szLabel)>0) ) { //GetEngine()->DrawString( iCentreX+m_iXLabelOffset+1, iCentreY+m_iYLabelOffset+1, m_szLabel, 0xffffff ); GetEngine()->DrawScreenString( iCentreX+m_iXLabelOffset, iCentreY+m_iYLabelOffset, m_szLabel, uiColourText ); } // Store the position at which the object was last drawn // You MUST do this to ensure that the screen is updated when only drawing movable objects // This tells the system where to 'undraw' the object from StoreLastScreenPositionAndUpdateRect(); }
void Super::Draw(void) { if (!readyToDelete()) { ImageData x; x.LoadImage("Images/Powerup/invincibility.png"); x.RenderImageWithMask( GetEngine()->GetForeground(),0,0, m_iCurrentScreenX, m_iCurrentScreenY, x.GetWidth(), x.GetHeight() ); m_iDrawWidth = m_iDrawHeight = (float)x.GetWidth(); StoreLastScreenPositionAndUpdateRect(); } }
void Demo2Object::Draw() { // Do not draw if it should not be visible if ( !IsVisible() ) return; m_pMainEngine->DrawScreenOval( m_iCurrentScreenX - 10, m_iCurrentScreenY - 10, m_iCurrentScreenX +5, m_iCurrentScreenY + 5, rand() % 0xffffff ); // Store the position at which the object was last drawn // You MUST do this to ensure that the screen is updated when only drawing movable objects // This tells the system where to 'undraw' the object from StoreLastScreenPositionAndUpdateRect(); }
/** Draw the player object. Could be a simple shape but this makes a fake ball shape and labels it. */ void Ball::Draw() { // Do not draw if it should not be visible if ( !IsVisible() ) return; unsigned int uiColourMult = 0x010001; unsigned int uiColourText = 0xffffff; // Choose one of 8 colours: switch( m_iColour % 8 ) { case 1: uiColourMult = 0x010000; uiColourText = 0xffffff; break; case 2: uiColourMult = 0x000100; uiColourText = 0xffffff; break; case 3: uiColourMult = 0x000001; uiColourText = 0xffffff; break; case 4: uiColourMult = 0x010001; uiColourText = 0; break; case 5: uiColourMult = 0x010100; uiColourText = 0; break; case 6: uiColourMult = 0x000101; uiColourText = 0; break; case 7: uiColourMult = 0x010101; uiColourText = 0; break; default: uiColourMult = 0x000000; break; } int iRadiusSquared = (m_iDrawWidth/2) * (m_iDrawWidth/2); int iCentreX = m_iCurrentScreenX + m_iStartDrawPosX + m_iDrawWidth/2; int iCentreY = m_iCurrentScreenY + m_iStartDrawPosY + m_iDrawHeight/2; for ( int iX = m_iCurrentScreenX + m_iStartDrawPosX ; iX < (m_iCurrentScreenX + m_iStartDrawPosX + m_iDrawWidth) ; iX++ ) for ( int iY = m_iCurrentScreenY + m_iStartDrawPosY ; iY < (m_iCurrentScreenY + m_iStartDrawPosY + m_iDrawHeight) ; iY++ ) if ( ( (iX-iCentreX)*(iX-iCentreX) + (iY-iCentreY)*(iY-iCentreY) ) <= iRadiusSquared ) { unsigned int uiColour = (0xB0 * ((iX-iCentreX)*(iX-iCentreX) + (iY-iCentreY)*(iY-iCentreY))) / iRadiusSquared; uiColour = 0xff - uiColour; GetEngine()->SafeSetScreenPixel( iX, iY, uiColourMult * uiColour ); } StoreLastScreenPositionAndUpdateRect(); }