void CheckLives()
{
	//game is in player displayer lives at top right
	hud.SetDisplayInt(4, lives, 0.86f, 0.93f);

	//levelnum
	hud.SetDisplayInt(8, currentLevel, 0.52f, 0.93f);

	//if game is over display final score
	if(gameOver)
	{
		ShowScores();
		hud.SetDisplayString(3, "", 0.0f, 0.0f);
		hud.SetDisplayString(0, "", 0.3f, 0.55f);
		hud.SetDisplayString(2, "    Game Over\nYour Score:\n\n\n -High Scores-\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nBackspace = Restart", 0.4f, 0.65f);
		hud.SetDisplayString(4, "", 0.3f, 0.55f);
	}

	//check if level is complete
	if(nextLevel)
	{
		hud.SetDisplayString(3, "", 0.0f, 0.0f);
		hud.SetDisplayString(0, "", 0.3f, 0.55f);
		hud.SetDisplayString(2, "Level Complete!\n\nPress Enter to Progress", 0.3f, 0.55f);
		hud.SetDisplayString(4, "", 0.3f, 0.55f);
	}
}
void KeyboardUpCallback(unsigned char key, int x, int y)
{
	gKeys[key] = false;

	switch (key)
	{
		case 'p': { bPause = !bPause; 
					if (bPause)
						hud.SetDisplayString(1, "Paused - Hit \"p\" to Unpause", 0.3f, 0.55f);
					else
						hud.SetDisplayString(1, "", 0.0f, 0.0f);	
					getElapsedTime(); 
					break; }
		case 'x': { bShadows = !bShadows; break; }
		case 'b': { bDebugWireframeMode = !bDebugWireframeMode; break; }
		case 'c': { 
					// Reset the box
					NxMat33 m;
					m.id();
					box1->setGlobalOrientation(m);
					box1->setGlobalPosition(NxVec3(5,3.5,0));
					box1->setLinearVelocity(NxVec3(0,0,0));
					box1->setAngularVelocity(NxVec3(0,0,0));

					ChangeKernel();
					break; 
				  }
		case 27 : { exit(0); break; }
		default : { break; }
	}
}
void UpdateTime()
{
	if(!gameOver)
	{
		hud.SetDisplayInt(29, minutes, 0.25f, 0.01f);	
		//code to manually place a 0 before any seond number lower than 10
		if(seconds < 10)
		{
			hud.SetDisplayString(31, "Playtime:      : 0", 0.10f, 0.01f);
			hud.SetDisplayInt(30, seconds, 0.31f, 0.01f);
		}
		else
		{
			hud.SetDisplayString(31, "Playtime:      :", 0.10f, 0.01f);
			hud.SetDisplayInt(30, seconds, 0.30f, 0.01f);
		}
	}
	else
	{
		hud.SetDisplayInt(29, minutes, -100.25f, 0.01f);	
		//code to manually place a 0 before any seond number lower than 10
		if(seconds < 10)
		{
			hud.SetDisplayString(31, "Playtime:      : 0", -100.10f, 0.01f);
			hud.SetDisplayInt(30, seconds, -100.31f, 0.01f);
		}
		else
		{
			hud.SetDisplayString(31, "Playtime:      :", -100.10f, 0.01f);
			hud.SetDisplayInt(30, seconds, -100.30f, 0.01f);
		}
	}
}
void KeyboardUpCallback(unsigned char key, int x, int y)
{
	gKeys[key] = false;

	switch (key)
	{
		case 'p': { bPause = !bPause; 
					if (bPause)
						hud.SetDisplayString(1, "Paused - Hit \"p\" to Unpause", 0.3f, 0.55f);
					else
						hud.SetDisplayString(1, "", 0.0f, 0.0f);	
					getElapsedTime(); 
					break; }
	
		case 'f': { bForceMode = !bForceMode; break; }
	    case 'b': 
			{
				box = CreateBox(NxVec3(2,5-0.75,7), NxVec3(0.75,0.75,0.75), 1);
	  			sphere = CreateSphere(NxVec3(0,4-0.4,1), 0.4, 1);
	  			capsule = CreateCapsule(NxVec3(3,0-(1+0.5),8), 1, 1, 1);
		 		break; 
	  		  }	
		case 27 : { exit(0); break; }
		default : { break; }
	}
}
void ProcessInputs()
{
    UpdateWheelShapeUserData();

    ProcessForceKeys();

	if (bSetCurrentMotorTorque1)
	{
		bSetCurrentMotorTorque1 = false;
		wheel1->setMotorTorque(gCurrentMotorTorque1);
		// Set motor torque #1 in HUD
		char ds[512];
		sprintf(ds, "Left wheel torque: %d", gCurrentMotorTorque1);
		hud.SetDisplayString(2, ds, 0.015f, 0.92f);
	}

	if (bSetCurrentMotorTorque2)
	{
		bSetCurrentMotorTorque2 = false;
		wheel2->setMotorTorque(gCurrentMotorTorque2);
		// Set motor torque #2 in HUD
		char ds[512];
		sprintf(ds, "Right wheel torque: %d", gCurrentMotorTorque2);
		hud.SetDisplayString(3, ds, 0.015f, 0.87f);
	}

    // Show debug wireframes
    if (bDebugWireframeMode) 
	{
		if (gScene)
		{
			gDebugRenderer.renderData(*gScene->getDebugRenderable());
		}
    }
}
void InitializeSpecialHUD()
{
	char ds[512];

	// Add joint type to HUD
    sprintf(ds, "JOINT TYPE: %s", gJointTypeString[gJointType]);
	hud.AddDisplayString(ds, 0.015f, 0.92f); 

	// Add rotation title to HUD
    sprintf(ds, "ROTATION:");
	hud.AddDisplayString(ds, 0.015f, 0.87f); 

	// Add rotation motions to HUD
    sprintf(ds, "   twistMotion: %s", gJointMotionString[2]);
	hud.AddDisplayString(ds, 0.015f, 0.82f); 
    sprintf(ds, "   swing1Motion: %s", gJointMotionString[2]);
	hud.AddDisplayString(ds, 0.015f, 0.77f); 
    sprintf(ds, "   swing2Motion: %s", gJointMotionString[2]);
	hud.AddDisplayString(ds, 0.015f, 0.72f); 

	// Add translation title to HUD
	sprintf(ds, "TRANSLATION:");
	hud.AddDisplayString(ds, 0.015f, 0.67f); 

	// Add translation motions to HUD
    sprintf(ds, "   xMotion: %s", gJointMotionString[gJointMotion[0]]);
	hud.AddDisplayString(ds, 0.015f, 0.62f); 
    sprintf(ds, "   yMotion: %s", gJointMotionString[gJointMotion[1]]);
	hud.AddDisplayString(ds, 0.015f, 0.57f); 
    sprintf(ds, "   zMotion: %s", gJointMotionString[gJointMotion[2]]);
	hud.AddDisplayString(ds, 0.015f, 0.52f);
}
void KeyboardUpCallback(unsigned char key, int x, int y)
{
	gKeys[key] = false;

	switch (key)
	{
		case 'p': { bPause = !bPause; 
					if (bPause)
						hud.SetDisplayString(2, "Paused - Hit \"p\" to Unpause", 0.3f, 0.55f);
					else
						hud.SetDisplayString(2, "", 0.0f, 0.0f);	
					break; }
		case 'x': { bShadows = !bShadows; break; }
		case 'b': { bDebugWireframeMode = !bDebugWireframeMode; break; }		
		case 'f': { bForceMode = !bForceMode; break; }

		case 'o': 
		{     
			NxCloth** cloths = gScene->getCloths();
			for (NxU32 i = 0; i < gScene->getNbCloths(); i++) 
			{
				cloths[i]->setFlags(cloths[i]->getFlags() ^ NX_CLF_BENDING_ORTHO);
			}
			break;
		}

		case 'g': 
		{     
			NxCloth** cloths = gScene->getCloths();
			for (NxU32 i = 0; i < gScene->getNbCloths(); i++) 
			{
				cloths[i]->setFlags(cloths[i]->getFlags() ^ NX_CLF_GRAVITY);
			}
			break;
		}

		case 'y': 
		{
			NxCloth** cloths = gScene->getCloths();
			for (NxU32 i = 0; i < gScene->getNbCloths(); i++) 
			{
				cloths[i]->setFlags(cloths[i]->getFlags() ^ NX_CLF_BENDING);
			}	            
			break;
		}
		case ' ': 
		{
			NxActor* sphere = CreateSphere(gCameraPos, 1, 1);
			sphere->setLinearVelocity(gCameraForward * 20);
			break; 
		}
		case 27 : { exit(0); break; }
		default : { break; }
	}
}
void CheckScore()
{
	if(!gameOver && !nextLevel)
		hud.SetDisplayInt(1, score, 0.14f, 0.93f);
	if(gameOver)
		hud.SetDisplayInt(1, score, 0.56f, 0.62f);
	if(!gameOver)
		hud.SetDisplayInt(1, score, 0.14f, 0.93f);
	if(nextLevel)
		hud.SetDisplayInt(1, score, -10.14f, 0.93f);
}
void InitializeSpecialHUD()
{
	char ds[512];

	// Add motor torque #1 to HUD
    sprintf(ds, "Left wheel torque: %d", gCurrentMotorTorque1);
	hud.AddDisplayString(ds, 0.015f, 0.92f); 

	// Add motor torque #2 to HUD
    sprintf(ds, "Right wheel torque: %d", gCurrentMotorTorque2);
	hud.AddDisplayString(ds, 0.015f, 0.87f);
}
void ProcessInputs()
{
    UpdateWheelShapeUserData();

    ProcessForceKeys();

	if (bSetCurrentSteerAngle)
	{
		bSetCurrentSteerAngle = false;
        wheel1->setSteerAngle(gCurrentSteerAngle);
		// Add front wheel steer angle to HUD
		char ds[512];
		sprintf(ds, "Front Wheel Steer Angle: %d", (int)(gCurrentSteerAngle*180.0/NxPi));
		hud.SetDisplayString(2, ds, 0.015f, 0.92f);
	}

	if (bSetCurrentMotorTorque)
	{
		bSetCurrentMotorTorque = false;
        wheel2->setMotorTorque(gCurrentMotorTorque);
        wheel3->setMotorTorque(gCurrentMotorTorque);
		// Add rear wheel motor torque to HUD
		char ds[512];
		sprintf(ds, "Rear Wheel Motor Torque: %d", gCurrentMotorTorque);
		hud.SetDisplayString(3, ds, 0.015f, 0.87f);
	}

	if (bSetCurrentBrakeTorque)
	{
		bSetCurrentBrakeTorque = false;
		wheel2->setBrakeTorque(gCurrentBrakeTorque);
		wheel3->setBrakeTorque(gCurrentBrakeTorque);				
		// Add rear wheel brake torque to HUD
		char ds[512];
		sprintf(ds, "Rear Wheel Brake Torque: %d", gCurrentBrakeTorque);
		hud.SetDisplayString(4, ds, 0.015f, 0.82f);
	}


    // Show debug wireframes
    if (bDebugWireframeMode) 
	{
		if (gScene)
		{
			gDebugRenderer.renderData(*gScene->getDebugRenderable());
		}
    }
}
Exemple #11
0
//----------------------------DRAW LABYRINTHE - PLAYER - ENEMIES - UI
void DrawLevel() {

	glPushMatrix();

	if (inGame)
	{
		// Translate Map
		glTranslatef(-player.GetPos().x + (windowWidth / 2), -player.GetPos().y + (windowHeight / 2), 0);

		// Draw map
		lvl.DisplayMap();

		//Draw Enemies
		lvl.DrawSpecialCases();

		//Draw Enemies
		lvl.DrawEnemies();

		if (player.GetPos().z == 1) { // If the player is UP
			// Draw UpCase under the player and his fire
			lvl.DrawUpCase();
		}

		//Draw Fires
		lvl.DrawAllFires();

		// Add player
		player.Draw(inGame);

		if (player.GetPos().z == 0) { // If the player is DOWN
			// Draw UpCase over the player and his fire
			lvl.DrawUpCase();
		}

		
		glLoadIdentity();
		glutSwapBuffers();
		glPopMatrix();

		//Draw HUD
		hud.displayScore(lvl.HUD_Score(), player.GetLife(), player.GetWeapon());
		
	}

	else
	{
		lvl.DisplayMap();

		//Draw Menu
		menu.Display();

		// Add player
		player.Draw(inGame);

		glLoadIdentity();
		glutSwapBuffers();
		glPopMatrix();
	}

}
void InitializeSpecialHUD()
{
	char ds[512];

	// Add front wheel steer angle to HUD
    sprintf(ds, "Front Wheel Steer Angle: %d", (int)(gCurrentSteerAngle*180.0/NxPi));
	hud.AddDisplayString(ds, 0.015f, 0.92f); 

	// Add rear wheel motor torque to HUD
    sprintf(ds, "Rear Wheel Motor Torque: %d", gCurrentMotorTorque);
	hud.AddDisplayString(ds, 0.015f, 0.87f);

	// Add rear wheel brake torque to HUD
    sprintf(ds, "Rear Wheel Brake Torque: %d", gCurrentBrakeTorque);
	hud.AddDisplayString(ds, 0.015f, 0.82f);
}
void ProcessInputs()
{
	DisableAKey('t');
    ProcessForceKeys();

	UpdateJointMotorTarget();

	if (bReconfigureD6Joint)
	{
		bReconfigureD6Joint = false;
		gJointType = (gJointType+1)%gNumJointConfigurations; 
		ReconfigureD6Joint();
	}

	if (bToggleLowerActorGravity)
	{
		char ds[512];

        bToggleLowerActorGravity = false;
        if (capsule2->readBodyFlag(NX_BF_DISABLE_GRAVITY))
            capsule2->clearBodyFlag(NX_BF_DISABLE_GRAVITY);   
        else
            capsule2->raiseBodyFlag(NX_BF_DISABLE_GRAVITY);

		// Set lower actor gravity in HUD
		sprintf(ds, "Lower Actor Gravity: %s", gOnOffString[!capsule2->readBodyFlag(NX_BF_DISABLE_GRAVITY)]);
		hud.SetDisplayString(11, ds, 0.015f, 0.47f);
    }

    // Show debug wireframes
	if (bDebugWireframeMode)
	{
		if (gScene)  gDebugRenderer.renderData(*gScene->getDebugRenderable());
	}
}
void UnShowScores()
{
	int count = 9;
	for(int i = 0; i < 10; i++)
	{
		if(orderedScores[i] > 0)
		{			
			hud.SetDisplayInt(count, 0, -100.55f, 0.5f - ((float)i/40)); 
			char *display = &orderedNames[i][0];
			count++;
  			hud.SetDisplayString(count, "", -100.4f, 0.5f - ((float)i/40));
			count ++;
		}
	}
	count = 0;
}
void RenderCallback()
{
    // Clear buffers
    glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

	ProcessCameraKeys();
	SetupCamera();

    if (gScene && !bPause)
	{
		GetPhysicsResults();
        ProcessInputs();
		StartPhysics();
	}

    // Display scene
 	RenderActors(bShadows);

	if (bForceMode)
		DrawForce(gSelectedActor, gForceVec, NxVec3(1,1,0));
	else
		DrawForce(gSelectedActor, gForceVec, NxVec3(0,1,1));
	gForceVec = NxVec3(0,0,0);

	// Render HUD
	hud.Render();

    glFlush();
    glutSwapBuffers();
}
void InitializeHUD()
{
	hud.Clear();
	if (0 != gScene)
	{
		if (NX_SIMULATION_HW == gScene->getSimType())
			hud.AddDisplayString("Hardware Scene", 0.74f, 0.92f);
		else
			hud.AddDisplayString("Software Scene", 0.74f, 0.92f);
	}

	// Add pause to HUD
	if (bPause)  
		hud.AddDisplayString("Paused - Hit \"p\" to Unpause", 0.3f, 0.55f);
	else
		hud.AddDisplayString("", 0.0f, 0.0f);
}
MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::MainWindow) {
    ui->setupUi(this);
//    ui->mygl->setFocus();
//    ui->stackedWidget->setst
    MyGL *gl = new MyGL();
    gl->parentView = this->ui->graphicsView;
    HUD *hud = new HUD();
    hud->setFocusPolicy(Qt::ClickFocus);
    this->ui->graphicsView->setScene(new QGraphicsScene(this->ui->graphicsView));
    this->ui->graphicsView->scene()->addWidget(gl);
    this->ui->graphicsView->scene()->addWidget(hud);
    this->ui->graphicsView->gl = gl;
    this->ui->graphicsView->hud = hud;
    QObject::connect(this->ui->loadHeightmap, &QPushButton::clicked, gl, &MyGL::slot_loadImage);
}
void InitializeSpecialHUD()
{
	char ds[512];

	// Add lesson title string to HUD
	sprintf(ds, gTitleString);
	hud.AddDisplayString(ds, 0.015f, 0.92f);
}
void InitializeHUD()
{
	bHardwareScene = (gScene->getSimType() == NX_SIMULATION_HW);

	hud.Clear();

	// Add hardware/software to HUD
	if (bHardwareScene)
	    hud.AddDisplayString("Hardware Scene", 0.74f, 0.92f);
	else
		hud.AddDisplayString("Software Scene", 0.74f, 0.92f);

	// Add pause to HUD
	if (bPause)  
		hud.AddDisplayString("Paused - Hit \"p\" to Unpause", 0.3f, 0.55f);
	else
		hud.AddDisplayString("", 0.0f, 0.0f);
}
void KeyboardUpCallback(unsigned char key, int x, int y)
{
	gKeys[key] = false;

	switch (key)
	{
	    case '0': { gPerfRenderer.toggleEnable(); break; }
		case 'p': { bPause = !bPause; 
					if (bPause)
						hud.SetDisplayString(1, "Paused - Hit \"p\" to Unpause", 0.3f, 0.55f);
					else
						hud.SetDisplayString(1, "", 0.0f, 0.0f);	
					getElapsedTime(); 
					break; }
		case 'x': { bShadows = !bShadows; break; }
		case 'b': { bDebugWireframeMode = !bDebugWireframeMode; break; }		
		case 'f': { bForceMode = !bForceMode; break; }
		case 27 : { exit(0); break; }

		// Switch simulation threads mode
		case 't': {	ReleaseNx();
					gbThreadScheduler = gbThreadPolling = gbThreadSDKManage = gbNoThread = false;
					gbThreadScheduler = true;
					InitNx();
					break; }
		case 'y': {	ReleaseNx();
					gbThreadScheduler = gbThreadPolling = gbThreadSDKManage = gbNoThread = false;
					gbThreadPolling = true;
					InitNx();
					break; }
		case 'g': {	ReleaseNx();
					gbThreadScheduler = gbThreadPolling = gbThreadSDKManage = gbNoThread = false;
					gbThreadSDKManage = true;
					InitNx();
					break; }
		case 'h': {	ReleaseNx();
					gbThreadScheduler = gbThreadPolling = gbThreadSDKManage = gbNoThread = false;
					gbNoThread = true;
					InitNx();
					break; }
		default : { break; }
	}
}
void KeyboardUpCallback(unsigned char key, int x, int y)
{
	gKeys[key] = false;

	switch (key)
	{
		case 'p': { bPause = !bPause; 
					if (bPause)
						hud.SetDisplayString(1, "Paused - Hit \"p\" to Unpause", 0.3f, 0.55f);
					else
						hud.SetDisplayString(1, "", 0.0f, 0.0f);	
					getElapsedTime(); 
					break; }
		case 'x': { bShadows = !bShadows; break; }
		case 'b': { bDebugWireframeMode = !bDebugWireframeMode; break; }		
		case 'f': { bForceMode = !bForceMode; break; }
		case 27 : { exit(0); break; }
		default : { break; }
	}
}
Exemple #22
0
void EstadoMuerte::Dibujar(MotorJuego* juego){
    EstadoJugando* estjue = EstadoJugando::Instance();
    Motor2D* motor2D = Motor2D::Instance();
    motor2D->limpiarVentana();
    Vistas* general = Vistas::Instance();
    juego->ventana->setView(general->getGeneral());
    estjue->getNiveles()->dibujarNivel();
    motor2D->pintarSprites(pj);
    HUD* hud = HUD::Instance();
    juego->ventana->setView(hud->getHUD());
    hud->dibujar();
    Minimapa* minimapa = Minimapa::Instance();
    juego->ventana->setView(minimapa->getMinimapa());
    minimapa->dibujar();
    juego->ventana->setView(juego->ventana->getDefaultView());
    rec.setSize(juego->ventana->getDefaultView().getSize());
    motor2D->pintarRectShape(rec);
    motor2D->pintarTexto(texto);
    motor2D->pintarVentana();
}
HUD* HUD::createHUD()	{
	HUD* hud = new HUD();
	hud->create();
	hud->init();
	hud->autorelease();
	hud->setColor( Color3B::BLACK );
	hud->setAnchorPoint( Vec2(0, 0) );
	hud->initOption();

	return hud;
}
void RenderCallback()
{
	// Clear buffers
	glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

	ProcessCameraKeys();
	SetupCamera();

	UpdateEmitterPosition();

	if (gScene && !bPause)
	{
		GetPhysicsResults();
		ProcessInputs();
		StartPhysics();
	}

	// Display scene
	RenderActors(bShadows);

	RenderFluid();

	if (bForceMode)
		DrawForce(gSelectedActor, gForceVec, NxVec3(1,1,0));
	else
		DrawForce(gSelectedActor, gForceVec, NxVec3(0,1,1));
	gForceVec = NxVec3(0,0,0);

	if (bEmitterWireframe)
	{
		NxMat34 fluidEmitterMat = fluidEmitter->getGlobalPose();
		NxVec3 fluidEmitterPos, fluidEmitterDir;
		fluidEmitterPos = fluidEmitterMat.t;
		fluidEmitterMat.M.getColumn(2,fluidEmitterDir);

		DrawArrow(fluidEmitterPos, fluidEmitterPos + fluidEmitterDir, NxVec3(0,0,1)); 
		DrawEllipse(20, fluidEmitter->getGlobalPose(), NxVec3(0.5,0,0.5), fluidEmitter->getDimensionX(), fluidEmitter->getDimensionY());
	}

	if (!bPause)
	{
		if (gDeltaTime < 10)  gTotalTime += gDeltaTime;
	}

	// Render HUD
	hud.Render();

	glFlush();
	glutSwapBuffers();
}
void RenderCallback()
{
    // Clear buffers
    glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

    ProcessCameraKeys();
	SetupCamera();

    if (gScene && !bPause)
	{
		GetPhysicsResults();
        ProcessInputs();
		StartPhysics();
	}

    // Display scene
 	RenderActors(bShadows);

	// Display kernel Info
	if (gForceField)
	{
		if (gForceField->getForceFieldKernel() == gCustomKernel)
		{
			hud.SetDisplayString(2, "Using CustomKernel", 0.14f, 0.92f);
		}
		else if (gForceField->getForceFieldKernel() == gLinearKernel)
		{
			hud.SetDisplayString(2, "Using LinearKernel", 0.14f, 0.92f);
		}
	}
	
	// Render the HUD
	hud.Render();

    glFlush();
    glutSwapBuffers();
}
void InitializeSpecialHUD()
{
	char ds[512];

	// Add joint type to HUD
    sprintf(ds, "JOINT TYPE: %s", gJointTypeString[gJointType]);
	hud.AddDisplayString(ds, 0.015f, 0.92f); 

	// Add rotation title to HUD
    sprintf(ds, "ROTATION:");
	hud.AddDisplayString(ds, 0.015f, 0.87f); 

	// Add rotation motions to HUD
    sprintf(ds, "   Axis: %s", gJointMotionString[gJointMotion[3]]);
	hud.AddDisplayString(ds, 0.015f, 0.82f); 
    sprintf(ds, "   Normal: %s", gJointMotionString[gJointMotion[4]]);
	hud.AddDisplayString(ds, 0.015f, 0.77f); 
    sprintf(ds, "   Binormal: %s", gJointMotionString[gJointMotion[5]]);
	hud.AddDisplayString(ds, 0.015f, 0.72f); 

	// Add translation title to HUD
	sprintf(ds, "TRANSLATION:");
	hud.AddDisplayString(ds, 0.015f, 0.67f); 

	// Add translation motions to HUD
    sprintf(ds, "   Axis: %s", gJointMotionString[gJointMotion[0]]);
	hud.AddDisplayString(ds, 0.015f, 0.62f); 
    sprintf(ds, "   Normal: %s", gJointMotionString[gJointMotion[1]]);
	hud.AddDisplayString(ds, 0.015f, 0.57f); 
    sprintf(ds, "   Binormal: %s", gJointMotionString[gJointMotion[2]]);
	hud.AddDisplayString(ds, 0.015f, 0.52f);

	// Add lower actor gravity to HUD
	sprintf(ds, "Lower Actor Gravity: %s", gOnOffString[!capsule2->readBodyFlag(NX_BF_DISABLE_GRAVITY)]);
	hud.AddDisplayString(ds, 0.015f, 0.47f);
}
Exemple #27
0
void main() {
	cout << "ok";

	//--------------------- LOAD ARDUINO'S COMMUNICATION

	if (SP->IsConnected())
		printf("We're connected");

	//char incomingData[256] = "";	// don't forget to pre-allocate memory



	//------------------LOAD RANDOM
	srand(time(NULL)); // Create a seed to start the random from
	
	//------------------ LOAD PLAYER' SAVE
	//lvl.LoadGame("player1.txt");

	//Gestion de la fenetre
	//glutInitWindowPosition(10, 10);
	//glutInitWindowSize(1000, 1000);
	glutInitDisplayMode(GLUT_RGBA | GLUT_SINGLE);		//A remplacer pour l'affichage sur d'autres PC par GLUT_DOUBLE
	//glutInitDisplayMode(GLUT_RGBA | GLUT_DOUBLE);
	glutCreateWindow("TerraSkweek");
	glutFullScreen();           // making the window full screen


	//----------------------- LOAD EVERYBODY'S SPRITES
	menu.LoadAllTextures();
	lvl.LoadAllTextures();
	player.LoadAllTextures();
	hud.LoadAllTextures();
		
	//Gestion des evenements
	glutDisplayFunc(Display);
	glutReshapeFunc(Redim);
	glutSpecialFunc(KeyAction); // Switch player's direction

	glutKeyboardFunc(KeyButtons);// Keyboard keys to control the HUD // and Fire
	//glutTimerFunc(700, EnemiesTimer, 0); // Direction for the enemiesd
	glutTimerFunc(refreshRate, PlayerMovt, 0); // Continuous movement of the player
	glutTimerFunc(enemySpawnFrequency, ActivateSpawnMob, 0);
	//glutIdleFunc(Idle);

	glutMainLoop();
}
void InitializeHUD()
{
	bHardwareScene = (gScene->getSimType() == NX_SIMULATION_HW);

	hud.Clear();

	// Add hardware/software to HUD
	if (bHardwareScene)
	    hud.AddDisplayString("Hardware Scene", 0.74f, 0.92f);
	else
		hud.AddDisplayString("Software Scene", 0.74f, 0.92f);

	// Add pause to HUD
	if (bPause)  
		hud.AddDisplayString("Paused - Hit \"p\" to Unpause", 0.3f, 0.55f);
	else
		hud.AddDisplayString("", 0.0f, 0.0f);

	if (gbThreadScheduler)
	{
		hud.AddDisplayString("Simulation threads custom scheduler", 0.01f, 0.92f);
	}
	else if (gbThreadPolling)
	{
		hud.AddDisplayString("Simulation threads polling", 0.01f, 0.92f);
	}
	else if (gbThreadSDKManage)
	{
		hud.AddDisplayString("Simulation threads managed by SDK", 0.01f, 0.92);
	}
	else if (gbNoThread)
	{
		hud.AddDisplayString("No simulation threads", 0.01f, 0.92f);
	}
	else
		assert(0);
}
void Display()
{
	//clear display buffers
	glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

	//set the camera view
	SetupCamera();

	//display scene
	if (rendering_mode != RENDER_WIREFRAME)
		RenderActors(bShadows);
	if (debugRenderable)
		gDebugRenderer.renderData(*debugRenderable);

	

	//render HUD	
	hud.Render();

	glFlush();
	glutSwapBuffers();
}
void RenderCallback()
{
    if (gScene && !bPause)
	{
		StartPhysics();	
		GetPhysicsResults();
	}

    // Clear buffers
    glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

	ProcessInputs();
	ProcessCameraKeys();
	SetupCamera();

 	RenderActors(bShadows);

    // Render all the cloths in the scene
	for (MyCloth **cloth = gCloths.begin(); cloth != gCloths.end(); cloth++)
	{
		glColor4f(1.0f, 0.0f, 0.0f,1.0f);
		(*cloth)->draw(bShadows);
	}

	if (bForceMode)
		DrawForce(gSelectedActor, gForceVec, NxVec3(1,1,0));
	else
		DrawForce(gSelectedActor, gForceVec, NxVec3(0,1,1));
	gForceVec = NxVec3(0,0,0);

	// Render HUD
	hud.Render();

    glFlush();
    glutSwapBuffers();
}