Skip to content

Commit 4871971

Browse files
committed
start adding, but comment out, fixed update code, may not want to do this... will think about later
1 parent f91e165 commit 4871971

2 files changed

Lines changed: 13 additions & 2 deletions

File tree

src/engine/Engine.cpp

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@
1818
static Engine *instance = NULL;
1919
#endif
2020

21+
// TODO: DO WE NEED FIXED UPDATES?
22+
// std::chrono::microseconds FIXED_TIME_STEP(std::chrono::milliseconds(20));
23+
2124
Engine::Engine(Game *game)
2225
{
2326
log_info("Initializing SDL");
@@ -56,6 +59,8 @@ void Engine::start(void)
5659
m_window->makeCurrentContext();
5760

5861
m_time = std::chrono::high_resolution_clock::now();
62+
// TODO: DO WE NEED FIXED UPDATES?
63+
//m_physicsTimeSimulated = std::chrono::high_resolution_clock::now();
5964

6065
#ifdef EMSCRIPTEN
6166
instance = this;
@@ -89,6 +94,12 @@ void Engine::tick(void)
8994

9095
m_physicsManager->tick(m_deltaTime);
9196

97+
/* TODO: DO WE NEED FIXED UPDATES?
98+
while (m_physicsTimeSimulated < m_time) {
99+
100+
m_physicsTimeSimulated += FIXED_TIME_STEP;
101+
}*/
102+
92103
game->update(m_window->getInput(), m_deltaTime);
93104

94105
game->render(m_glManager.get());

src/engine/Engine.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,6 @@
1616
#include "Input.h"
1717
#include "components/Sphere.h"
1818

19-
#define FIXED_TIME_STEP 20
20-
2119
class Engine
2220
{
2321
public:
@@ -46,6 +44,8 @@ class Engine
4644
std::chrono::high_resolution_clock::time_point m_time, m_lastTime;
4745
std::chrono::microseconds m_deltaTime;
4846

47+
//std::chrono::high_resolution_clock::time_point m_physicsTimeSimulated;
48+
4949
Game *game;
5050

5151
Input input;

0 commit comments

Comments
 (0)