本文整理汇总了C++中Paddle::pos方法的典型用法代码示例。如果您正苦于以下问题:C++ Paddle::pos方法的具体用法?C++ Paddle::pos怎么用?C++ Paddle::pos使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Paddle
的用法示例。
在下文中一共展示了Paddle::pos方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: step
void GameDrawer::step() {
//Avanza el juego
game->advance(STEP_TIME);
//Mueve el terreno
fieldTextureOffset += STEP_TIME / FIELD_TEXTURE_TIME;
while (fieldTextureOffset > FIELD_TEXTURE_SIZE) {
fieldTextureOffset -= FIELD_TEXTURE_SIZE;
}
bool opponentAlive = false;
for(int i = 0; i < 4; i++) {
Paddle* paddle = game->paddles()[i];
if (paddle != NULL) {
oldPaddlePos[i] = paddle->pos();
}
//Actualiza opacidad
if (paddle == NULL) {
paddleFadeAmounts[i] -= STEP_TIME / PADDLE_FADE_OUT_TIME;
if (paddleFadeAmounts[i] < 0) {
if (i == 0) {
isGameOver0 = true;
}
paddleFadeAmounts[i] = 0;
}
else if (i != 0) {
opponentAlive = true;
}
}
else if (i != 0) {
opponentAlive = true;
}
}
if (!opponentAlive) {
isGameOver0 = true;
}
}
示例2: drawPaddlesAndPoles
void GameDrawer::drawPaddlesAndPoles(bool isReflected) {
glEnable(GL_NORMALIZE);
for(int i = 0; i < 4; i++) {
Paddle* paddle = game->paddles()[i];
//Rotar
glPushMatrix();
switch(i) {
case 1:
glTranslatef(0, 0, 1);
glRotatef(90, 0, 1, 0);
break;
case 2:
glTranslatef(1, 0, 1);
glRotatef(180, 0, 1, 0);
break;
case 3:
glTranslatef(1, 0, 0);
glRotatef(270, 0, 1, 0);
break;
}
if (paddle != NULL || paddleFadeAmounts[i] > 0) {
//Draw the paddle
glPushMatrix();
float paddlePos;
if (paddle != NULL) {
paddlePos = paddle->pos();
}
else {
paddlePos = oldPaddlePos[i];
}
glTranslatef(paddlePos, 0.055f, PADDLE_OFFSET);
if (paddle == NULL) {
//Used for the shrinking effect, whereby paddles shrink
//until they disappear when they are eliminated from play
glTranslatef(0, -0.055f * (1 - paddleFadeAmounts[i]), 0);
glScalef(paddleFadeAmounts[i],
paddleFadeAmounts[i],
paddleFadeAmounts[i]);
}
glRotatef(-90, 0, 1, 0);
glRotatef(-90, 1, 0, 0);
glScalef(0.05f, 0.05f, 0.05f);
glColor3f(1, 1, 1);
glutSolidSphere(1.5, 10, 6);
glPopMatrix();
}
if (paddle == NULL) {
//Dibuja pared
if (isReflected) {
glDisable(GL_NORMALIZE);
}
glCallList(poleDisplayListId);
if (isReflected) {
glEnable(GL_NORMALIZE);
}
}
glPopMatrix();
}
}