public override void Draw(float x, float y)
{
Vector4 color = this.ForeColor;
if((_cvar == null) && (_buddyWindow == null))
{
return;
}
if((_thumbWidth == 0) || (_thumbHeight == 0))
{
_thumbWidth = _thumbMaterial.ImageWidth;
_thumbHeight = _thumbMaterial.ImageHeight;
}
UpdateConsoleVariables(true);
if(_value > _high)
{
_value.Set(_high);
}
else if(_value < _low)
{
_value.Set(_low);
}
float range = _high - _low;
if(range <= 0.0f)
{
return;
}
float thumbPosition = (range > 0) ? ((_value - _low) / range) : 0;
if(_vertical == true)
{
if(_verticalFlip == true)
{
thumbPosition = 1.0f - thumbPosition;
}
thumbPosition *= this.DrawRectangle.Height - _thumbHeight;
thumbPosition += this.DrawRectangle.Y;
_thumbRect.Y = thumbPosition;
_thumbRect.X = this.DrawRectangle.X;
}
else
{
thumbPosition *= this.DrawRectangle.Width - _thumbWidth;
thumbPosition += this.DrawRectangle.X;
_thumbRect.X = thumbPosition;
_thumbRect.Y = this.DrawRectangle.Y;
}
_thumbRect.Width = _thumbWidth;
_thumbRect.Height = _thumbHeight;
if((this.Hover != null) && (this.NoEvents == false) && (this.Contains(this.UserInterface.CursorX, this.UserInterface.CursorY) == true))
{
color = this.HoverColor;
}
else
{
this.Hover = false;
}
if((this.Flags & WindowFlags.Capture) == WindowFlags.Capture)
{
color = this.HoverColor;
this.Hover = true;
}
this.DeviceContext.DrawMaterial(_thumbRect.X, _thumbRect.Y, _thumbRect.Width, _thumbRect.Height, _thumbMaterial, color);
if((this.Flags & WindowFlags.Focus) == WindowFlags.Focus)
{
this.DeviceContext.DrawRectangle(_thumbRect.X + 1.0f, _thumbRect.Y + 1.0f, _thumbRect.Width - 2.0f, _thumbRect.Height - 2.0f, 1.0f, color);
}
}