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


C++ Engine::ChangesState方法代码示例

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


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

示例1: Update

void Game::Update()
{
	if (isEntered)
	{
		enteredTime += APP.GetDeltaTime();
		if (enteredTime>0.5f)
		{
			isEntered   = false;
			enteredTime = 0.0;
		}
	}

	bool changeButton = APP.GetKey(GLFW_KEY_F1);
	if (changeButton&&!isEntered)
	{
		Engine *engine = Engine::Instance();
		engine->ChangesState("intro");
	}

	tank->MoveUp   (APP.GetKey(GLFW_KEY_UP)   ||APP.GetKey('W'));
	tank->MoveDown (APP.GetKey(GLFW_KEY_DOWN) ||APP.GetKey('S'));
	tank->MoveLeft (APP.GetKey(GLFW_KEY_LEFT) ||APP.GetKey('A'));
	tank->MoveRight(APP.GetKey(GLFW_KEY_RIGHT)||APP.GetKey('D'));

	for (unsigned int i=0; i<entities.size(); i++)
	{
		IEntity* entity = entities[i];
		entity->Update();
	}
}
开发者ID:Orgil,项目名称:rrc-tank,代码行数:30,代码来源:Game.cpp

示例2:

void Demo01::Update() {
	if (isEntered) {
		enteredTime += APP.GetDeltaTime();
		if (enteredTime > 0.5f) {
			isEntered = false;
			enteredTime = 0.0;
		}
	}

	bool changeButton = APP.GetKey(GLFW_KEY_F1);
	if (changeButton && !isEntered) {
		Engine *engine = Engine::Instance();
		engine->ChangesState("game");
	}

	bool shouldMoveForward  = APP.GetKey('W');
	bool shouldMoveBackward = APP.GetKey('S');
	bool shouldMoveLeft     = APP.GetKey('A');
	bool shouldMoveRight    = APP.GetKey('D');
	camera.MoveForward (shouldMoveForward);
	camera.MoveBackward(shouldMoveBackward);
	camera.MoveLeft    (shouldMoveLeft);
	camera.MoveRight   (shouldMoveRight);
	camera.UpdateFOV(APP.GetMouseWheel());

	float angleX = (float)APP.GetDeltaX();
	float angleY = (float)APP.GetDeltaY();
	camera.UpdateAngles(angleX, angleY);

	camera.Update();

	mvpMat =  modelMat * camera.GetProjMat() * camera.GetViewMat();
}
开发者ID:Orgil,项目名称:rrc-tank,代码行数:33,代码来源:Demo01.cpp

示例3:

void Demo02::Update() {
	if (isEntered) {
		enteredTime += APP.GetDeltaTime();
		if (enteredTime > 0.5f) {
			isEntered = false;
			enteredTime = 0.0;
		}
	}

	bool changeButton = APP.GetKey(GLFW_KEY_F1);
	if (changeButton && !isEntered) {
		Engine *engine = Engine::Instance();
		engine->ChangesState("demo01");
	}

	if (APP.GetKey(GLFW_KEY_F2)){
		isPolygonMode = !isPolygonMode;
		if (isPolygonMode)
			glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
		else
			glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
	}

	bool shouldMoveForward  = APP.GetKey('W');
	bool shouldMoveBackward = APP.GetKey('S');
	bool shouldMoveLeft     = APP.GetKey('A');
	bool shouldMoveRight    = APP.GetKey('D');
	camera.MoveForward (shouldMoveForward);
	camera.MoveBackward(shouldMoveBackward);
	camera.MoveLeft    (shouldMoveLeft);
	camera.MoveRight   (shouldMoveRight);
	camera.UpdateFOV(APP.GetMouseWheel());

	float angleX = (float)APP.GetDeltaX();
	float angleY = (float)APP.GetDeltaY();
	camera.UpdateAngles(angleX, angleY);

	camera.Update();

	//modelMatrix      = glm::rotate(glm::mat4(1.0f), 90.0f, glm::vec3(0,0,1));
	modelMatrix      = glm::scale(glm::mat4(1.0f), glm::vec3(0.005f));
	viewMatrix       = camera.GetViewMat();
	projectionMatrix = camera.GetProjMat();

	normalMatrix = glm::inverse(glm::transpose(glm::mat3(viewMatrix*modelMatrix)));
}
开发者ID:bilgoude,项目名称:rrc-tank,代码行数:46,代码来源:Demo02.cpp

示例4:

void Demo05::Update() {
	if (isEntered) {
		enteredTime += APP.GetDeltaTime();
		if (enteredTime > 0.5f) {
			isEntered = false;
			enteredTime = 0.0;
		}
	}

	bool changeButton = APP.GetKey(GLFW_KEY_F1);
	if (changeButton && !isEntered) {
		Engine *engine = Engine::Instance();
		engine->ChangesState("demo01");
	}

	bool shouldMoveForward  = APP.GetKey('W');
	bool shouldMoveBackward = APP.GetKey('S');
	bool shouldMoveLeft     = APP.GetKey('A');
	bool shouldMoveRight    = APP.GetKey('D');
	camera.MoveForward (shouldMoveForward);
	camera.MoveBackward(shouldMoveBackward);
	camera.MoveLeft    (shouldMoveLeft);
	camera.MoveRight   (shouldMoveRight);
	camera.UpdateFOV(APP.GetMouseWheel());

	float angleX = (float)APP.GetDeltaX();
	float angleY = (float)APP.GetDeltaY();
	camera.UpdateAngles(angleX, angleY);

	camera.Update();

	modelMatrix      = glm::rotate(glm::scale(glm::mat4(1.0f), glm::vec3(2.0f)), 90.0f, glm::vec3(0,0,1));
	viewMatrix       = camera.GetViewMat();
	projectionMatrix = camera.GetProjMat();

	modelViewMatrix  = viewMatrix * modelMatrix;

}
开发者ID:bilgoude,项目名称:rrc-tank,代码行数:38,代码来源:Demo05.cpp


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