本文整理汇总了C++中Entities::CheckCollision方法的典型用法代码示例。如果您正苦于以下问题:C++ Entities::CheckCollision方法的具体用法?C++ Entities::CheckCollision怎么用?C++ Entities::CheckCollision使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Entities
的用法示例。
在下文中一共展示了Entities::CheckCollision方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Display
//=======================================================================
// Display Function
//=======================================================================
void Display(void)
{
current_time = glutGet(GLUT_ELAPSED_TIME);
if(current_time - previous_time > 15)
{
previous_time = current_time;
elapsedTimeLastFrame = current_time - lastFrame;
glClear(GL_COLOR_BUFFER_BIT);
switch(GameState)
{
case GAMEOVER:
glColor3f(1.0, 0.0, 0.0);
glLineWidth(20);
renderText("GAME OVER", WIDTH/5, HEIGHT/2, 10);
glLineWidth(1);
DisplayScore();
break;
case GAMEPLAY:
glColor3f(1.0, 1.0, 1.0);
Ship(WIDTH/2, HEIGHT/2, shipRotation);
EnemyList.Render(elapsedTimeLastFrame);
glColor3f(1,0,0);
bulletsList.Render(elapsedTimeLastFrame);
if(fireLaser)
Laser();
DisplayScore();
DisplayHints();
CalculateFPS();
DisplayFPS();
break;
}
/* update animation */
bulletsList.CheckCollision(&EnemyList);
lastFrame = current_time;
glutSwapBuffers();
}
glutPostRedisplay();
}
示例2: timer
//=======================================================================
// Timer Function
//=======================================================================
void timer(int)
{
/* update animation */
CalculateFPS();
bulletsList.CheckCollision(&EnemyList);
glutPostRedisplay();
glutTimerFunc(1000.f/60.f, timer, 0);
}