本文整理汇总了C++中Dot::getColliders方法的典型用法代码示例。如果您正苦于以下问题:C++ Dot::getColliders方法的具体用法?C++ Dot::getColliders怎么用?C++ Dot::getColliders使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Dot
的用法示例。
在下文中一共展示了Dot::getColliders方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
int main( int argc, char* args[] )
{
//Start up SDL and create window
if( !init() )
{
printf( "Failed to initialize!\n" );
}
else
{
//Load media
if( !loadMedia() )
{
printf( "Failed to load media!\n" );
}
else
{
//Main loop flag
bool quit = false;
//Event handler
SDL_Event e;
//The background scrolling offset
int scrollingOffset = 0;
//Angle of rotation
double degrees = 0;
//The dot that will be moving around on the screen
Dot dot ( 100, 300);
//Opening Fonts and message
TTF_Font *times;
times = TTF_OpenFont("arial.ttf", 14);
SDL_Color white = {255, 255, 255};
std::stringstream health;
health <<"Health:" << dot.hp << " Points: " << POINTS;
const std::string str = health.str();
SDL_Surface *surface = TTF_RenderText_Solid(times,
health.str().c_str(), white);
SDL_Texture * texture = SDL_CreateTextureFromSurface(gRenderer,
surface);
int texW = 0;
int texH = 0;
SDL_QueryTexture(texture, NULL, NULL, &texW, &texH);
SDL_Rect dstrect = { 0, 0, texW, texH };
//creating enemies
std::vector<Enemy*> enemies;
for (int i = 0; i < NumberEnemies; i++)
{
enemies.push_back(new Enemy(i*100, 0));
}
//Flip type
SDL_RendererFlip flipType = SDL_FLIP_NONE;
//While application is running
while( !quit)
{
//Handle events on queue
while( SDL_PollEvent( &e ) != 0 )
{
//User requests quit
if( e.type == SDL_QUIT )
{
quit = true;
}
dot.handleEvent(e);
}
//rotating
degrees += 1;
//collision between enemies and bullets
for (int i = 0; i < enemies.size(); i++)
{
for (int j = 0; j < bulletsUp.size(); j++)
{
enemies[i]->move(bulletsUp[j]->getColliders());
}
for (int j = 0; j < bulletsLeft.size(); j++)
{
enemies[i]->move(bulletsLeft[j]->getColliders());
}
for (int j = 0; j < bulletsRight.size(); j++)
//.........这里部分代码省略.........