Ignored first two seconds of triggering to give switches time to position themselves.
This commit is contained in:
parent
80df2aac41
commit
1ad25ef8cb
6
level.cc
6
level.cc
@ -56,8 +56,8 @@ void Level::render(ACGL::OpenGL::SharedShaderProgram shader, bool lightingPass,
|
||||
}
|
||||
}
|
||||
|
||||
void Level::update(float runTime, glm::vec2 mouseDelta, bool wPressed, bool aPressed, bool sPressed, bool dPressed,bool kPressed, bool lPressed) {
|
||||
physics.takeUpdateStep(runTime);
|
||||
void Level::update(float runTimeSinceLastUpdate, float runTime, glm::vec2 mouseDelta, bool wPressed, bool aPressed, bool sPressed, bool dPressed,bool kPressed, bool lPressed) {
|
||||
physics.takeUpdateStep(runTimeSinceLastUpdate);
|
||||
|
||||
// Ignore first two mouse updates, because they are incorrect
|
||||
// DON'T try to move this functionallity elsewhere
|
||||
@ -103,9 +103,11 @@ void Level::update(float runTime, glm::vec2 mouseDelta, bool wPressed, bool aPre
|
||||
skydome->setPosition(glm::vec3(cameraCenter->getPosition().x,
|
||||
0.0f, cameraCenter->getPosition().z));
|
||||
|
||||
if (runTime > 2.0f) {
|
||||
for(unsigned int i = 0; i<triggers.size(); i++) {
|
||||
triggers.at(i).triggerUpdate();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
glm::vec3 Level::getAmbientLight() {
|
||||
|
2
level.hh
2
level.hh
@ -24,7 +24,7 @@ class Level {
|
||||
Level();
|
||||
~Level();
|
||||
void load();
|
||||
void update(float runTime, glm::vec2 mouseDelta,bool wPressed, bool aPressed,bool sPressed, bool dPressed, bool kPressed, bool lPressed);
|
||||
void update(float runTimeSinceLastUpdate, float runTime, glm::vec2 mouseDelta,bool wPressed, bool aPressed,bool sPressed, bool dPressed, bool kPressed, bool lPressed);
|
||||
void render(ACGL::OpenGL::SharedShaderProgram shader, bool lightingPass,
|
||||
glm::mat4* viewProjectionMatrix, std::vector<glm::mat4>* shadowVPs=0);
|
||||
glm::vec3 getAmbientLight();
|
||||
|
4
main.cc
4
main.cc
@ -161,13 +161,13 @@ int main( int argc, char *argv[] )
|
||||
double xpos, ypos;
|
||||
glfwGetCursorPos(window, &xpos, &ypos);
|
||||
glfwSetCursorPos(window, app.getGraphics()->getWindowSize().x/2, app.getGraphics()->getWindowSize().y/2);
|
||||
app.getLevel()->update(now - lastUpdate,
|
||||
app.getLevel()->update(now - lastUpdate, now,
|
||||
glm::vec2((float)ypos-app.getGraphics()->getWindowSize().y/2,
|
||||
(float)xpos-app.getGraphics()->getWindowSize().x/2),
|
||||
stateW == GLFW_PRESS,stateA == GLFW_PRESS,stateS == GLFW_PRESS,stateD == GLFW_PRESS,stateK == GLFW_PRESS,stateL == GLFW_PRESS);
|
||||
}
|
||||
else {
|
||||
app.getLevel()->update(now - lastUpdate, glm::vec2(0.0f, 0.0f), false, false, false, false,false,false);
|
||||
app.getLevel()->update(now - lastUpdate, now, glm::vec2(0.0f, 0.0f), false, false, false, false,false,false);
|
||||
if (app.isLocked()) {
|
||||
app.ignoredOneMouseUpdate();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user