public virtual void Draw(float x, float y)
{
if(this.Disposed == true)
{
throw new ObjectDisposedException(this.GetType().Name);
}
int skipShaders = idE.CvarSystem.GetInteger("r_skipGuiShaders");
if((skipShaders == 1) || (this.DeviceContext == null))
{
return;
}
int time = this.UserInterface.Time;
if(((this.Flags & WindowFlags.Desktop) == WindowFlags.Desktop) && (skipShaders != 3))
{
RunTimeEvents(time);
}
if(skipShaders == 2)
{
return;
}
if((this.Flags & WindowFlags.ShowTime) == WindowFlags.ShowTime)
{
this.DeviceContext.DrawText(string.Format("{0:0} seconds\n{1}", (float) (_timeLine - _timeLine) / 1000, this.UserInterface.State.GetString("name")), 0.35f, 0, idColor.White, new idRectangle(100, 0, 80, 80), false);
}
if((this.Flags & WindowFlags.ShowCoordinates) == WindowFlags.ShowCoordinates)
{
this.DeviceContext.ClippingEnabled = false;
this.DeviceContext.DrawText(string.Format("x: {0} y: {1} cursorx: {2} cursory: {3}", (int) _rect.X, (int) _rect.Y, (int) this.UserInterface.CursorX, (int) this.UserInterface.CursorY), 0.25f, 0, idColor.White, new idRectangle(0, 0, 100, 20), false);
this.DeviceContext.ClippingEnabled = true;
}
if(_visible == false)
{
return;
}
CalculateClientRectangle(0, 0);
SetFont();
// see if this window forces a new aspect ratio
_context.SetSize(_forceAspectWidth, _forceAspectHeight);
//FIXME: go to screen coord tracking
_drawRect.Offset(x, y);
_clientRect.Offset(x, y);
_textRect.Offset(x, y);
_actualX = _drawRect.X;
_actualY = _drawRect.Y;
Vector3 oldOrigin;
Matrix oldTransform;
this.DeviceContext.GetTransformInformation(out oldOrigin, out oldTransform);
SetupTransforms(x, y);
DrawBackground(_drawRect);
DrawBorderAndCaption(_drawRect);
if((_flags & WindowFlags.NoClip) == 0)
{
this.DeviceContext.PushClipRectangle(_clientRect);
}
if(skipShaders < 5)
{
DrawText(time, x, y);
}
if(idE.CvarSystem.GetInteger("gui_debug") > 0)
{
DrawDebug(time, x, y);
}
foreach(DrawWindow drawWindow in _drawWindows)
{
if(drawWindow.Window != null)
{
drawWindow.Window.Draw(_clientRect.X + _offsetX, _clientRect.Y + _offsetY);
}
else
{
drawWindow.Simple.Draw(_clientRect.X + _offsetX, _clientRect.Y + _offsetY);
}
}
// Put transforms back to what they were before the children were processed
this.DeviceContext.SetTransformInformation(oldOrigin, oldTransform);
if((this.Flags & WindowFlags.NoClip) == 0)
{
this.DeviceContext.PopClipRectangle();
}
if((idE.CvarSystem.GetBool("gui_edit") == true)
|| (((this.Flags & WindowFlags.Desktop) == WindowFlags.Desktop)
&& ((this.Flags & WindowFlags.NoCursor) == 0)
&& (this.HideCursor == false)
&& ((this.UserInterface.IsActive == true) || ((this.Flags & WindowFlags.MenuInterface) == WindowFlags.MenuInterface))))
{
this.DeviceContext.SetTransformInformation(Vector3.Zero, Matrix.Identity);
this.UserInterface.DrawCursor();
}
if((idE.CvarSystem.GetBool("gui_debug") == true) && ((this.Flags & WindowFlags.Desktop) == WindowFlags.Desktop))
{
this.DeviceContext.ClippingEnabled = false;
this.DeviceContext.DrawText(string.Format("x: {0:00} y: {1:00}", this.UserInterface.CursorX, this.UserInterface.CursorY), 0.25f, 0, idColor.White, new idRectangle(0, 0, 100, 20), false);
this.DeviceContext.DrawText(this.UserInterface.SourceFile, 0.25f, 0, idColor.White, new idRectangle(0, 20, 300, 20), false);
this.DeviceContext.ClippingEnabled = true;
}
_drawRect.Offset(-x, -y);
_clientRect.Offset(-x, -y);
_textRect.Offset(-x, -y);
}