TurtleBrains  0.2.1
High quality, portable, C++ API for native application and game development.
Game Loop

The game loop is split into three primary functions; Simulate, Update and Render that keep the game moving along and displaying new frames.

  • Simulate can be called 0 to N times per frame and will be called at a fixed time interval. Generally this is where game logic should be placed so that the game is deterministic. By default this fixed time interval is called at 100hz although can be modified with TurtleBrains::Game::GameTimer::SetMillisecondsPerStep().

  • Update will be called once per frame, every frame, and is supplied with the deltaTime. deltaTime is the amount of time that passed since the previous call, although clamped to a maximum of 1/30 if the previous frame took longer. Update is generally where input should be checked since input is polled once a frame and Simulate could skip a key press or release.

  • Render is also called exactly once per frame, after both Simulate and Update calls so that the new frame can be displayed.