I have put together some Useful Hack Functions.
Credits to Misc people, but mostly to UC.
I did make the crosshair function.
Mabye this could get stickied?
If anybody wants to add a function, leave me a PM and ill add it in.
Before we start, Make sure you have this in your globals:
[php]
LPD3DXFONT pFont;
LPDIRECT3DDEVICE9 pDevice;
[/php]
Draw Text:
After Globals:
[php]
void PrintText(LPD3DXFONT Font, long x, long y, D3DCOLOR fontColor, char *text, ...)//Draw Text Function
{
RECT rct;
rct.left = x - 1;
rct.right = x + 1;
rct.top = y - 1 ;
rct.bottom = y + 1;
Make Crosshair (Endscene):
[php]
DrawXHair(pDevice,D3DCOLOR_XRGB(0,0,0));
[/php]
Draw Box WITH Border
After Globals:
[php]
void FillRGB( int x, int y, int w, int h, D3DCOLOR color, IDirect3DDevice9* pDevice )
{
if( w < 0 )w = 1;
if( h < 0 )h = 1;
if( x < 0 )x = 1;
if( y < 0 )y = 1;
D3DRECT rec = { x, y, x + w, y + h };
pDevice->Clear( 1, &rec, D3DCLEAR_TARGET, color, 0, 0 );
}
void DrawBorder( int x, int y, int w, int h, int px, D3DCOLOR BorderColor, IDirect3DDevice9* pDevice )
{
FillRGB( x, (y + h - px), w, px, BorderColor, pDevice );
FillRGB( x, y, px, h, BorderColor, pDevice );
FillRGB( x, y, w, px, BorderColor, pDevice );
FillRGB( (x + w - px), y, px, h, BorderColor, pDevice );
}
void DrawBox( int x, int y, int w, int h, D3DCOLOR BoxColor, D3DCOLOR BorderColor, IDirect3DDevice9* pDevice )
{
FillRGB( x, y, w, h, BoxColor, pDevice );
DrawBorder( x, y, w, h, 1, BorderColor, pDevice );
}
[/php]
And to create the box (Endscene):
[php]
DrawBox (X,Y,W,H,Back Color,Border Color,pDevice);
[/php]
Draw Circle
Globals:
[php]
ID3DXLine *pLine; #define PI 3.14159265
[/php]
After Globals:
[php]
void DrawCircle(int X, int Y, int radius, int numSides, DWORD Color)
{
D3DXVECTOR2 Line[128];
float Step = PI * 2.0 / numSides;
int Count = 0;
for (float a=0; a < PI*2.0; a += Step)
{
float X1 = radius * cos(a) + X;
float Y1 = radius * sin(a) + Y;
float X2 = radius * cos(a+Step) + X;
float Y2 = radius * sin(a+Step) + Y;
Line[Count].x = X1;
Line[Count].y = Y1;
Line[Count+1].x = X2;
Line[Count+1].y = Y2;
Count += 2;
}
pLine->Begin();
pLine->Draw(Line,Count,Color);
pLine->End();
}
[/php]
Create the line(with your font):
[php]
D3DXCreateLine(pDevice,&pLine);
[/php]
And to draw the circle(Endscene):
[php]
DrawCircle(X,Y,R,S,COLOR);
[/php]
I havent perfected the circle, but when i do i will update.