本文整理汇总了C++中Door::DrawCage方法的典型用法代码示例。如果您正苦于以下问题:C++ Door::DrawCage方法的具体用法?C++ Door::DrawCage怎么用?C++ Door::DrawCage使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Door
的用法示例。
在下文中一共展示了Door::DrawCage方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
//.........这里部分代码省略.........
//PLAY GAME STATE
int dir = player.Move(inputHandler, e);
for (int i = 0; i < cannons.size(); i++)
{
cannons.at(i)->Update();
}
SDL_Rect rec(player.spriteRect);
rec.y = player.GetY();
for (int j = 0; j < cannons.size(); j++)
{
for (int i = 0; i < cannons.at(j)->fireballs.size(); i++)
{
if (cannons.at(j)->fireballs.at(i)->CheckCollision(&rec) == true)
{
std::cout << "Collision Detected!" << std::endl;
player.Respawn();
button.setOnce(false);
button.buttonBody->SetTransform(b2Vec2(880 / SCALE, 39 / SCALE), 0);
door.spriteRect->x = -1000;
door.spriteRect->y = -1000;
player.prevPosX.clear();
player.prevPosY.clear();
player.count = 0;
}
}
}
button.Update();
if (button.CheckCollision(&rec) == true)
{
std::cout << "Collision Detected!" << std::endl;
button.collision = true;
button.spriteRect->x = -2000;
button.spriteRect->y = -2000;
button.buttonBody->SetTransform(b2Vec2(-2000, -2000), 0);
//door.Draw(renderer);
}
if (door.CheckCollision(&rec) == true)
{
button.buttonBody->SetTransform(b2Vec2(880 / SCALE, 39/ SCALE), 0);
std::cout << "Collision Detected!" << std::endl;
player.Respawn();
button.setOnce(false);
door.spriteRect->x = -1000;
door.spriteRect->y = -1000;
player.prevPosX.clear();
player.prevPosY.clear();
player.count = 0;
player.Respawn();
menu->playBool = false;
menu->quitBool = false;
menu->backGroundRect->x = 0;
menu->current = 0;
button.collision = false;
}
if (button.collision == false)
{
door.DrawCage(renderer);
}
if (button.collision == true)
{
door.DrawNoCage(renderer);
}
int ticks = SDL_GetTicks();
int seconds = ticks / 50;
int sprite = seconds % 8;
renderer->Update(player.srcRect, player.dstRect, *player.LeftTexture, *player.RightTexture, *player.StandTexture, sprite, dir, player.moving, player.GetY());
player.dstRect.w = player.spriteRect.w;
player.dstRect.h = player.spriteRect.h;
player.dstRect.x = player.spriteRect.x;
player.dstRect.y = player.spriteRect.y + 5;
}
if (menu->quitBool == true)
{
quit = true;
}
fpsthink();
if (fpsTimer == 60)
{
printf("%f\n", framespersecond);
fpsTimer = 0;
}
fpsTimer++;
}
SDL_DestroyRenderer(renderer->ren);
SDL_DestroyWindow(win);
SDL_DestroyMutex(mutex);
SDL_Quit();
return 0;
}