Add turbo bar
This commit is contained in:
parent
598d709910
commit
7c410aee09
@ -38,6 +38,8 @@ public:
|
||||
glm::vec3 color = glm::vec3(0.3, 0.3, 0.5);
|
||||
float roughness = 0.5;
|
||||
float metallic = 0.6;
|
||||
float turbo = 1.0f;
|
||||
float turboMAX = 1.0f;
|
||||
|
||||
glm::vec3 spaceshipPos /*= glm::vec3(0.065808f, 1.250000f, -2.189549f)*/;
|
||||
glm::vec3 spaceshipDir = glm::vec3(-0.490263f, 0.000000f, 0.871578f);
|
||||
@ -49,7 +51,7 @@ public:
|
||||
|
||||
glm::vec3 cameraPos = glm::vec3(0.479490f, 1.250000f, -2.124680f);
|
||||
glm::vec3 cameraDir = glm::vec3(-0.354510f, 0.000000f, 0.935054f);
|
||||
glm::vec3 cameraPosHUDBar = glm::vec3(0.479490f, 1.250000f, -2.124680f);
|
||||
glm::vec3 cameraPosHUDBar = cameraPos;
|
||||
glm::mat4 additionalHorRotationMatrix;
|
||||
glm::mat4 additionalVerRotationMatrix;
|
||||
|
||||
@ -222,15 +224,28 @@ public:
|
||||
|
||||
if (w == GLFW_PRESS) {
|
||||
if (shiftState == GLFW_PRESS) {
|
||||
|
||||
turbo = glm::max(0.0f, turbo - 0.004f * deltaTime * 60);
|
||||
if (turbo == 0.0f) {
|
||||
shiftState = GLFW_RELEASE;
|
||||
moveSpeed = 0.05f * deltaTime * 60;
|
||||
setPerticlesParameters(100.f, 0.0001f);
|
||||
}
|
||||
else {
|
||||
moveSpeed *= 2;
|
||||
setPerticlesParameters(200.f, 0.00005f);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
else {
|
||||
setPerticlesParameters(100.f, 0.0001f);
|
||||
turbo = glm::min(turboMAX, turbo + 0.001f * deltaTime * 60);
|
||||
}
|
||||
}
|
||||
else {
|
||||
setPerticlesParameters(50.f, 0.0002f);
|
||||
turbo = glm::min(turboMAX, turbo + 0.005f * deltaTime * 60);
|
||||
}
|
||||
|
||||
if (glfwGetKey(window, GLFW_KEY_ESCAPE) == GLFW_PRESS) {
|
||||
|
@ -107,16 +107,28 @@ void renderHUD(GLFWwindow* window) {
|
||||
glm::mat4 modelMatrixHUD = spaceship->calculateModelMatrixForHUDBar();
|
||||
glm::mat4 healthBarPosition;
|
||||
glm::vec3 healthBarScale;
|
||||
glm::mat4 turboBarPosition;
|
||||
glm::vec3 turboBarScale;
|
||||
|
||||
if (glfwGetWindowAttrib(window, GLFW_MAXIMIZED)) {
|
||||
healthBarPosition = glm::translate(modelMatrixHUD, glm::vec3(38.0f, -11.0f, 0.0f));
|
||||
healthBarScale = glm::vec3(22.0f, 2.f, 1.0f);
|
||||
turboBarScale = healthBarScale;
|
||||
turboBarPosition = glm::translate(healthBarPosition, glm::vec3(0.0f, 3.5f, 0.0f));
|
||||
}
|
||||
else {
|
||||
healthBarScale = glm::vec3(22.0f, 4.f, 1.0f);
|
||||
healthBarPosition = glm::translate(modelMatrixHUD, glm::vec3(38.0f, -30.0f, 0.0f));
|
||||
turboBarScale = healthBarScale;
|
||||
turboBarPosition = glm::translate(healthBarPosition, glm::vec3(0.0f, 5.0f, 0.0f));
|
||||
}
|
||||
glUseProgram(programSpriteBar);
|
||||
glDisable(GL_DEPTH_TEST);
|
||||
spriteRenderer->DrawHUDBar(
|
||||
glm::vec3(0.0824f, 0.5725f, 0.9765f),
|
||||
glm::scale(turboBarPosition, turboBarScale),
|
||||
spaceship->turbo / spaceship->turboMAX,
|
||||
programSpriteBar);
|
||||
|
||||
spriteRenderer->DrawHUDBar(
|
||||
glm::vec3(0.0f, 1.0f, 0.0f),
|
||||
|
Loading…
Reference in New Issue
Block a user