idTech4.idSession.Draw C# (CSharp) Method

Draw() private method

private Draw ( ) : void
return void
		private void Draw()
		{			
			bool fullConsole = false;

			if(_insideExecuteMapChange == true)
			{
				if(_guiLoading != null)
				{
					_guiLoading.Draw(idE.System.FrameTime);
				}
				
				if(_guiActive == _guiMsg)
				{
					_guiMsg.Draw(idE.System.FrameTime);
				}
			}
			else if(_guiTest != null)
			{
				// if testing a gui, clear the screen and draw it
				// clear the background, in case the tested gui is transparent
				// NOTE that you can't use this for aviGame recording, it will tick at real com_frameTime between screenshots.
				idE.RenderSystem.Color = idColor.Black;
				idE.RenderSystem.DrawStretchPicture(0, 0, 640, 480, 0, 0, 1, 1, idE.DeclManager.FindMaterial("_white"));

				_guiTest.Draw(idE.System.FrameTime);
			}
			else if((_guiActive != null) && (_guiActive.State.GetBool("gameDraw") == false))
			{
				// draw the frozen gui in the background
				if((_guiActive == _guiMsg) && (_guiMsgRestore != null))
				{
					_guiMsgRestore.Draw(idE.System.FrameTime);
				}

				// draw the menus full screen
				if((_guiActive == _guiTakeNotes) && (idE.CvarSystem.GetBool("com_skipGameDraw") == false))
				{
					idE.Game.Draw(this.LocalClientIndex);
				}

				_guiActive.Draw(idE.System.FrameTime);
			}
			/*else if(readDemo)
			{
				rw->RenderScene(&currentDemoRenderView);
				renderSystem->DrawDemoPics();
			}*/
			else if(_mapSpawned == true)
			{
				bool gameDraw = false;

				// normal drawing for both single and multi player
				if((idE.CvarSystem.GetBool("com_skipGameDraw") == false) && (this.LocalClientIndex >= 0))
				{
					// draw the game view
					int start = idE.System.Milliseconds;
					gameDraw = idE.Game.Draw(this.LocalClientIndex);
					int end = idE.System.Milliseconds;

					// TODO: time_gameDraw += (end - start);	// note time used for com_speeds
				}

				if(gameDraw == false)
				{
					idE.RenderSystem.Color = idColor.Black;
					idE.RenderSystem.DrawStretchPicture(0, 0, 640, 480, 0, 0, 1, 1, idE.DeclManager.FindMaterial("_white"));
				}

				// save off the 2D drawing from the game
				// TODO: writedemo
				/*if(writeDemo)
				{
					renderSystem->WriteDemoPics();
				}*/
			}
			else
			{
				if(idE.CvarSystem.GetBool("com_allowConsole") == true)
				{
					idE.Console.Draw(true);
				}
				else
				{
					_emptyDrawCount++;

					if(_emptyDrawCount > 5)
					{
						// it's best if you can avoid triggering the watchgod by doing the right thing somewhere else
						idConsole.Warning("idSession: triggering mainmenu watchdog");
				
						_emptyDrawCount = 0;
						StartMenu();
					}
			
					idE.RenderSystem.Color = new Vector4(0, 0, 0, 1);
					idE.RenderSystem.DrawStretchPicture(0, 0, idE.VirtualScreenWidth, idE.VirtualScreenHeight, 0, 0, 1, 1, idE.DeclManager.FindMaterial("_white"));
				}

				fullConsole = true;
			}

			if((fullConsole == false) && (_emptyDrawCount > 0))
			{
				idConsole.DeveloperWriteLine("idSession: {0} empty frame draws", _emptyDrawCount);
				_emptyDrawCount = 0;
			}
	
			fullConsole = false;

			// draw the wipe material on top of this if it hasn't completed yet
			DrawWipeModel();

			// draw debug graphs
			// TODO: DrawCmdGraph();

			// draw the half console / notify console on top of everything
			if(fullConsole == false)
			{
				idE.Console.Draw(false);
			}
		}