rendered paste bodyusing System;
using System.Runtime.InteropServices;
using System.Drawing;
using System.Collections;
using System.Collections.Generic;
using Microsoft.DirectX;
using Microsoft.DirectX.Direct3D;
namespace KillShit.Engine
{
public class Debug
{
public enum MESSAGE_TYPE
{
INITIALIZE = -16744448,
INFORMATION = -7278960,
WARNING = -32,
MISCELLANEOUS = -5383962
};
public bool bDisposed = false;
public static List<DebugText> DebugText;
public Debug ( )
{
DebugText = new List<DebugText> ( );
}
public void Update ( float DeltaTime )
{
if ( DebugText.Capacity > 0 )
{
for ( int i = 0; i < DebugText.Count; i++ )
{
DebugText [ i ].Update ( DeltaTime );
}
}
}
public void Render ( )
{
if ( DebugText.Capacity > 0 )
{
int h = frmMain.pHeight;
//foreach ( DebugText dText in DebugText )
//{
// int Multiplier = DebugText.IndexOf ( dText ) + 1;
// int iYPos = Engine.Renderer.Driver.Text.MeasureSize ( dText.Text ).Height * Multiplier;
// if ( iYPos >= h )
// return;
// Engine.Renderer.Driver.Text.RenderText ( dText.Text, 0, iYPos, dText.Color );
//}
for ( int i = 0; i < DebugText.Count; i++ )
{
int Multiplier = DebugText.IndexOf ( DebugText [ i ] ) + 1;
int iYPos = Engine.Renderer.Driver.Text.MeasureSize ( DebugText [ i ].Text ).Height * Multiplier;
if ( iYPos >= h )
return;
Engine.Renderer.Driver.Text.RenderText ( DebugText [ i ].Text, 0, iYPos, DebugText [ i ].Color );
}
}
}
public void AddText ( string strText, int iColor )
{
DebugText.Add ( new DebugText ( strText, iColor ) );
}
public void Dispose ( )
{
DebugText.Clear ( );
bDisposed = true;
}
}
public class DebugText
{
string strText;
int iColor;
float TotalTime = 0f;
float TotalTime2 = 0f;
public DebugText ( string strText, int iColor )
{
this.strText = strText;
this.iColor = iColor;
}
public void Update ( float DeltaTime )
{
TotalTime += DeltaTime;
if ( TotalTime >= 1000 )
{
TotalTime2 += DeltaTime;
int iAlpha = System.Drawing.Color.FromArgb ( iColor ).A;
if ( TotalTime2 >= 5 )
{
iAlpha--;
TotalTime2 = 0;
}
if ( iAlpha > 0 )
{
iColor = System.Drawing.Color.FromArgb ( iAlpha,
System.Drawing.Color.FromArgb ( iColor ).R,
System.Drawing.Color.FromArgb ( iColor ).G,
System.Drawing.Color.FromArgb ( iColor ).B )
.ToArgb ( );
}
else
{
TotalTime = 0;
Debug.DebugText.Remove ( this );
}
}
}
public string Text
{
get { return strText; }
}
public int Color
{
get { return iColor; }
set { iColor = value; }
}
}
}