|
@@ -92,7 +92,7 @@ glm::vec2 playerVelocity;
|
|
|
void Game::Setup()
|
|
|
{
|
|
|
playerPostion = glm::vec2(10, 20);
|
|
|
- playerVelocity = glm::vec2(1, 0);
|
|
|
+ playerVelocity = glm::vec2(100, 5);
|
|
|
}
|
|
|
|
|
|
void Game::Update()
|
|
@@ -102,10 +102,12 @@ void Game::Update()
|
|
|
{
|
|
|
SDL_Delay(timeToWait);
|
|
|
}
|
|
|
+ double deltaTime = (SDL_GetTicks() - this->millisecsPerviousFrame) / 1000.0;
|
|
|
|
|
|
this->millisecsPerviousFrame = SDL_GetTicks();
|
|
|
|
|
|
- playerPostion += playerVelocity;
|
|
|
+ playerPostion.x += (playerVelocity.x * deltaTime);
|
|
|
+ playerPostion.y += (playerVelocity.y * deltaTime);
|
|
|
}
|
|
|
|
|
|
void Game::ProcessInput()
|