Ignored first two seconds of triggering to give switches time to position themselves.

This commit is contained in:
Steffen Fündgens 2015-03-02 14:28:19 +01:00
parent 80df2aac41
commit 1ad25ef8cb
3 changed files with 10 additions and 8 deletions

View File

@ -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() {

View File

@ -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();

View File

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