I am reading the source code to learn how MonoGame works internally, and in the Run(GameRunBehavior)
method of the Game
class I noticed the following:
case GameRunBehavior.Synchronous:
// XNA runs one Update even before showing the window
DoUpdate( new GameTime() );
Platform.RunLoop();
EndRun();
DoExiting();
break;
There’s DoUpdate()
Later on, inside the Platform.RunLoop()
it calls Game.Tick()
, which then calls internally DoUpdate()
again
From what I understand, it gets on an endless game loop on Platform.RunLoop()
until the user quits the game.
But why is it required to run that isolated DoUpdate()
before it gets on the loop?