found this on forums awhile ago and wanted to use it, it was that circle around the crosshair for a custom crosshair...i added it to my menu, went to test, got to it, and it crashed me...there somethin wrong with the coding?
Code:
ID3DXLine *pLine;
#define PI 3.14159265
int iCenterX = GetSystemMetrics( 0 ) / 2;
int iCenterY = GetSystemMetrics( 1 ) / 2;
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();
}
if( CH_xhair ==4 ){
DrawCircle(iCenterX,iCenterY,10,50,D3DCOLOR_ARGB( 255, 255 , 0 ,0));
D3DCOLOR xcolor = D3DCOLOR_ARGB( 255, 255, 0, 0 );
int size = 15, strong = 1;
int iCenterX = GetSystemMetrics( 0 ) / 2;
int iCenterY = GetSystemMetrics( 1 ) / 2;
if( iCenterX < 20 && iCenterY < 20 )
{
iCenterX = ( GetSystemMetrics( 0 ) / 2 );
iCenterY = ( GetSystemMetrics( 1 ) / 2 );
}
D3DRECT rec2 = { iCenterX- size, iCenterY, iCenterX+ size, iCenterY+ strong};
D3DRECT rec3 = { iCenterX, iCenterY- size, iCenterX+ strong,iCenterY+ size};
pDevice->Clear(1, &rec2, D3DCLEAR_TARGET, xcolor, 0, 0);
pDevice->Clear(1, &rec3, D3DCLEAR_TARGET, xcolor, 0, 0);
}
help will be appreciated. i really wanna use this cross hair
and i'd post credits since i'm posting the code, but i don't remember who posted it