本文整理汇总了C++中Explosion::GetRect方法的典型用法代码示例。如果您正苦于以下问题:C++ Explosion::GetRect方法的具体用法?C++ Explosion::GetRect怎么用?C++ Explosion::GetRect使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Explosion
的用法示例。
在下文中一共展示了Explosion::GetRect方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Draw
/*
================================================================================
Game::Draw
Gets called once per frame to draw the current snapshot of the game.
================================================================================
*/
void Game::Draw()
{
// clear the screen
SDL_SetRenderDrawColor(mRenderer, 0, 0, 0, 255);
SDL_RenderClear(mRenderer);
if (mBackground)
{
Render(mBackground->GetRenderable(), &mBackground->GetRect(), SDL_FLIP_NONE);
}
if (mForeground)
{
//Render(mForeground->GetRenderable(), &mForeground->GetRect(), SDL_FLIP_NONE);
}
if (mFlagPole)
{
Render(mFlagPole->GetRenderable(), &mFlagPole->GetRect(), SDL_FLIP_NONE);
}
//
// draw the grid
//
if (mGrid)
{
int tileWidth = mGrid->TileWidth();
int tileHeight = mGrid->TileHeight();
GG::Rect tileRect(0, 0, tileWidth, tileHeight);
for (int y = 0; y < mGrid->NumRows(); y++)
{
for (int x = 0; x < mGrid->NumCols(); x++)
{
const GG::Renderable* renderable = mGrid->GetTile(y, x)->GetRenderable();
if (renderable)
{
Render(renderable, &tileRect, SDL_FLIP_NONE);
}
tileRect.x += tileWidth;
}
tileRect.y += tileHeight;
tileRect.x = 0;
}
}
// Draw the collision rectangles
if (rectVisible)
{
SDL_SetRenderDrawColor(mRenderer, 255, 0, 0, 255);
SDL_RenderFillRect(mRenderer, &mRobot->GetBottomTileRect());
SDL_SetRenderDrawColor(mRenderer, 150, 0, 0, 255);
SDL_RenderFillRect(mRenderer, &mRobot->GetTopTileRect());
SDL_SetRenderDrawColor(mRenderer, 255, 255, 0, 255);
SDL_RenderFillRect(mRenderer, &mRobot->GetCollisonRect());
for (auto coinIt = mCoins.begin(); coinIt != mCoins.end(); ++coinIt)
{
Coin* coin = *coinIt;
SDL_RenderFillRect(mRenderer, &coin->GetRect());
}
for (auto crawlerIt = mCrawlers.begin(); crawlerIt != mCrawlers.end(); ++crawlerIt)
{
Crawler* crawler = *crawlerIt;
SDL_RenderFillRect(mRenderer, &crawler->GetCollisionRect());
}
for (auto meteorIt = mMeteors.begin(); meteorIt != mMeteors.end(); ++meteorIt)
{
Meteor* meteor = *meteorIt;
SDL_RenderFillRect(mRenderer, &meteor->GetRect());
}
SDL_SetRenderDrawColor(mRenderer, 0, 0, 255, 255);
for (auto crawlerIt = mCrawlers.begin(); crawlerIt != mCrawlers.end(); ++crawlerIt)
{
Crawler* crawler = *crawlerIt;
SDL_RenderFillRect(mRenderer, &crawler->GetTileRect());
}
}
//
// draw the robot
//
if (mRobot)
{
Render(mRobot->GetRenderable(), &mRobot->GetRect(), mRobot->GetDirection()?SDL_FLIP_HORIZONTAL:SDL_FLIP_NONE);
}
//
// draw the coins
//
std::list<Coin*>::iterator coinIt = mCoins.begin();
for ( ; coinIt != mCoins.end(); ++coinIt)
{
Coin* coin = *coinIt;
Render(coin->GetRenderable(), &coin->GetRect(), SDL_FLIP_NONE);
//.........这里部分代码省略.........