MCPcopy Create free account
hub / github.com/InoriRus/Kyty / RenderAndUpdate

Function RenderAndUpdate

source/emulator/src/Graphics/Window.cpp:324–351  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

322}
323
324static bool RenderAndUpdate(GameApi* game)
325{
326 static double lag = 0.0;
327
328 lag += game->m_current_time_seconds - game->m_previous_time_seconds;
329
330 int num = 0;
331
332 bool ok = true;
333
334 while (lag >= game->m_update_fixed_time)
335 {
336 if (num < game->m_max_updates_per_frame)
337 {
338 ok = ok && Update(game);
339
340 game->m_update_num++;
341 num++;
342 game->m_update_time_seconds = game->m_update_num * game->m_update_fixed_time;
343 }
344
345 lag -= game->m_update_fixed_time;
346 }
347
348 ok = ok && Render(game);
349
350 return ok;
351}
352
353bool game_init(GameApi* game, const Core::Timer& timer, void* data)
354{

Callers 1

game_render_and_updateFunction · 0.85

Calls 2

RenderFunction · 0.85
UpdateFunction · 0.70

Tested by

no test coverage detected