当前位置: 首页>>代码示例>>C++>>正文


C++ HUD类代码示例

本文整理汇总了C++中HUD的典型用法代码示例。如果您正苦于以下问题:C++ HUD类的具体用法?C++ HUD怎么用?C++ HUD使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了HUD类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: ProcessInputs

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());
		}
    }
}
开发者ID:daher-alfawares,项目名称:xr.desktop,代码行数:35,代码来源:Lesson702.cpp

示例2: InitializeSpecialHUD

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);
}
开发者ID:daher-alfawares,项目名称:xr.desktop,代码行数:32,代码来源:Lesson216.cpp

示例3: InitializeSpecialHUD

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);
}
开发者ID:daher-alfawares,项目名称:xr.desktop,代码行数:12,代码来源:Lesson702.cpp

示例4: ProcessInputs

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());
		}
    }
}
开发者ID:daher-alfawares,项目名称:xr.desktop,代码行数:48,代码来源:Lesson703.cpp

示例5: DrawLevel

//----------------------------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();
	}

}
开发者ID:ViolaineF,项目名称:TerraSkweek,代码行数:61,代码来源:Main.cpp

示例6: InitializeSpecialHUD

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);
}
开发者ID:daher-alfawares,项目名称:xr.desktop,代码行数:16,代码来源:Lesson703.cpp

示例7: ProcessInputs

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());
	}
}
开发者ID:daher-alfawares,项目名称:xr.desktop,代码行数:35,代码来源:Lesson211.cpp

示例8: RenderCallback

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();
}
开发者ID:daher-alfawares,项目名称:xr.desktop,代码行数:30,代码来源:Lesson213.cpp

示例9: InitializeHUD

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);
}
开发者ID:daher-alfawares,项目名称:xr.desktop,代码行数:17,代码来源:Lesson801.cpp

示例10: QMainWindow

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);
}
开发者ID:SirCarrius,项目名称:cis277final-1,代码行数:17,代码来源:mainwindow.cpp

示例11: InitializeSpecialHUD

void InitializeSpecialHUD()
{
	char ds[512];

	// Add lesson title string to HUD
	sprintf(ds, gTitleString);
	hud.AddDisplayString(ds, 0.015f, 0.92f);
}
开发者ID:daher-alfawares,项目名称:xr.desktop,代码行数:8,代码来源:Lesson1006.cpp

示例12: InitializeHUD

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);
}
开发者ID:daher-alfawares,项目名称:xr.desktop,代码行数:18,代码来源:Lesson703.cpp

示例13: CheckLives

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);
	}
}
开发者ID:mattmcginty89,项目名称:GameEngines,代码行数:27,代码来源:VisualDebugger.cpp

示例14: KeyboardUpCallback

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; }
	}
}
开发者ID:daher-alfawares,项目名称:xr.desktop,代码行数:31,代码来源:Lesson603.cpp

示例15: UpdateTime

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);
		}
	}
}
开发者ID:mattmcginty89,项目名称:GameEngines,代码行数:33,代码来源:VisualDebugger.cpp


注:本文中的HUD类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。