protected override void Update(GameTime gameTime)
{
// FIXME: this is a hack to get the render window up so we can show the loading messages.
// it doesn't usually come up until all initialization has been completed and one tick has been run.
// this causes none of the loading messages to appear and it looks like the program isn't loading!
if(_firstTick == true)
{
_firstTick = false;
return;
}
else if(_fullyInitialized == false)
{
// game specific initialization
InitGame();
_frameTime = 0;
_ticNumber = 0;
return;
}
_gameTime = gameTime;
// if "viewlog" has been modified, show or hide the log console
if(idE.CvarSystem.IsModified("win_viewlog") == true)
{
if((idE.CvarSystem.GetBool("com_skipRenderer") == false) && (idE.CvarSystem.GetInteger("net_serverDedicated") != 1))
{
idE.SystemConsole.Show(idE.CvarSystem.GetInteger("win_viewlog"), false);
}
idE.CvarSystem.ClearModified("win_viewlog");
}
//try
{
// pump all the events
idE.Input.Update();
// write config file if anything changed
// TODO: WriteConfiguration();
// change SIMD implementation if required
// TODO
/*if ( com_forceGenericSIMD.IsModified() ) {
InitSIMD();
}*/
idE.EventLoop.RunEventLoop();
// TODO: _ticNumber++ is temp, supposed to be in async thread
_ticNumber++;
_frameTime = _ticNumber * idE.UserCommandMillseconds;
/*idAsyncNetwork::RunFrame();*/
if(idE.AsyncNetwork.IsActive == true)
{
if(idE.CvarSystem.GetInteger("net_serverDedicated") != 1)
{
idE.Session.GuiFrameEvents();
idE.Session.UpdateScreen(false);
}
}
else
{
idE.Session.Frame();
// normal, in-sequence screen update
idE.Session.UpdateScreen(false);
}
// report timing information
// TODO: com_speeds, remember drawing is in Draw now!!
/*if ( com_speeds.GetBool() ) {
static int lastTime;
int nowTime = Sys_Milliseconds();
int com_frameMsec = nowTime - lastTime;
lastTime = nowTime;
Printf( "frame:%i all:%3i gfr:%3i rf:%3i bk:%3i\n", com_frameNumber, com_frameMsec, time_gameFrame, time_frontend, time_backend );
time_gameFrame = 0;
time_gameDraw = 0;
} */
_frameNumber++;
}
/*catch(Exception)
{
// an ERP_DROP was thrown
}*/
base.Update(gameTime);
}