本文整理汇总了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();
}
}
示例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();
}
示例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)));
}
示例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;
}