本文整理汇总了C++中Paddle::Draw方法的典型用法代码示例。如果您正苦于以下问题:C++ Paddle::Draw方法的具体用法?C++ Paddle::Draw怎么用?C++ Paddle::Draw使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Paddle
的用法示例。
在下文中一共展示了Paddle::Draw方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Render
void Render(Paddle p1, Paddle p2, Ball b, GLuint wins){
glClear(GL_COLOR_BUFFER_BIT);
glMatrixMode(GL_MODELVIEW);
p1.Draw();
p2.Draw();
b.Draw();
if (b.x + b.size < p1.x - p1.w){
DrawSprite(wins, 1.1, 0.8, 0.1, 0.08, 0);
}
else if (b.x - b.size > p2.x + p2.w){
DrawSprite(wins, -1.1, 0.8, 0.1, 0.08, 0);
}
}
示例2: Display
/**************************************************************************//**
* @author Paul Blasi, Caitlin Taggart
*
* @par Description:
* The display callback. Draws each of the objects and displays score for each
* player. If the game is currently paused, it also draws a translucent box
* over the play area and the text "Paused".
*
*****************************************************************************/
void Display(void)
{
int length;
glClear(GL_COLOR_BUFFER_BIT);
BALL.Draw();
LEFT_PLAYER.Draw();
RIGHT_PLAYER.Draw();
LEFT_WALL.Draw();
RIGHT_WALL.Draw();
TOP_WALL.Draw();
BOTTOM_WALL.Draw();
NET.Draw();
string right_score = to_string(RIGHT_PLAYER.Score);
string left_score = to_string(LEFT_PLAYER.Score);
glColor4fv(WHITE);
length = glutBitmapLength(GLUT_BITMAP_TIMES_ROMAN_24, (const unsigned char*)left_score.c_str());
glRasterPos2i(50 - (200.0 / SCREEN_WIDTH * length / 2.0), 90);
glutBitmapString(GLUT_BITMAP_TIMES_ROMAN_24, (const unsigned char*)left_score.c_str());
length = glutBitmapLength(GLUT_BITMAP_TIMES_ROMAN_24, (const unsigned char*)right_score.c_str());
glRasterPos2i(150 - (200.0 / SCREEN_WIDTH * length / 2.0), 90);
glutBitmapString(GLUT_BITMAP_TIMES_ROMAN_24, (const unsigned char*)right_score.c_str());
if (PAUSED)
{
float alphaBlack[4] = { 0.0, 0.0, 0.0, .60 };
Paddle temp;
temp = Paddle(Point(100, 50), 200, 100, alphaBlack);
temp.Draw();
glColor4fv(WHITE);
length = glutBitmapLength(GLUT_BITMAP_TIMES_ROMAN_24, (const unsigned char*)"PAUSED");
glRasterPos2i(100 - (200.0/SCREEN_WIDTH * length / 2.0), 50);
glutBitmapString(GLUT_BITMAP_TIMES_ROMAN_24, (const unsigned char*)"PAUSED");
}
//glFlush();
glutSwapBuffers();
}