예제 #1
0
void Aircraft::updateTexts()
{
	// Display hitpoints
	if (isDestroyed())
		mHealthDisplay->setString("");
	else
		mHealthDisplay->setString(toString(getHitpoints()) + " HP");
	mHealthDisplay->setPosition(0.f, 50.f);
	mHealthDisplay->setRotation(-getRotation());

	// Display missiles, if available
	if (mMissileDisplay)
	{
		if (mMissileAmmo == 0 || isDestroyed())
			mMissileDisplay->setString("");
		else
			mMissileDisplay->setString("Missiles: " + toString(mMissileAmmo));
	}
	if (mLaserDisplay)
	{
		if (mLaserAmmo == 0 || isDestroyed())
			mLaserDisplay->setString("");
		else
			mLaserDisplay->setString("Lasers: " + toString(mLaserAmmo));
	}
}
예제 #2
0
void Engine::paintGL() {
    glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
    glLoadIdentity();
    glTranslatef(0.0f, 2.0f, -15.0f);
    glRotatef(xAngle, 1.0f, 0.0f, 0.0f);
    glRotatef(yAngle, 0.0f, 1.0f, 0.0f);
    glScalef(scale, scale, scale);
    drawSea(SEA_SIZE);

    glColor3f(1,0,0);
    this->renderText(-23, 2, -15.0f, QString("Player 1"));
    this->renderText(-24, 1.1f, -15.0f, getHitpoints(&player1));

    glColor3f(0,0,1);
    this->renderText(19, 2, -15.0f, QString("Player 2"));
    this->renderText(20, 1.1f, -15.0f, getHitpoints(&player2));

    glColor3f(1,1,0);
    this->renderText(-0.5d, 1.0d, 1.0d, pauseText);

    glColor3f(0,1,0);
    this->renderText(-2.5d, 1.0d, -1.0d, checkForWinner());
    this->renderText(-4.5d, 1.0d, 1.0d, newGameText);

    glPushMatrix();
    glTranslatef(player1.xPos, 0, player1.zPos);
    glRotatef(player1.yAngle, 0, 1, 0);
    player1.draw(1, 0, 0);
    glPopMatrix();

    glPushMatrix();
    glTranslatef(player2.xPos, 0, player2.zPos);
    glRotatef(player2.yAngle, 0, 1, 0);
    player2.draw(0, 0, 1);
    glPopMatrix();

    Missile* m;
    foreach(m, missilesList) {
        glPushMatrix();
        glTranslatef(m->x, 0.4, m->z);
        glRotatef(m->angle, 0, 1, 0);
        m->draw();
        glPopMatrix();
    }
예제 #3
0
void Aircraft::updateTexts()
{
	mHealthDisplay->setString(toString(getHitpoints()) + " HP");
	mHealthDisplay->setPosition(0.f, 50.f);
	mHealthDisplay->setRotation(-getRotation());

	if (mMissileDisplay)
	{
		if (mMissileAmmo == 0)
			mMissileDisplay->setString("");
		else
			mMissileDisplay->setString("M: " + toString(mMissileAmmo));
	}
}
예제 #4
0
void Aircraft::updateText()
{
    mHealthDisplay->setString(std::to_string(getHitpoints()) + " HP");
    mHealthDisplay->setPosition(0.f, 50.f);
    mHealthDisplay->setRotation(-getRotation());
}