Pinoy Extreme Hackerz
After Register or Log in just click login on the right corner of the chatbox to activate it. Thank you!

________________________________________________________

Pagkatapos mag register o mag log in ay pindutin sa kanang bahagi ng ating chabox ang login upang ito ay aktibahin. Salamat!


▁ ▂ ▃ ▄ ▅ ▆ ▇ █ ☆Welcome To Pinoy Extreme Hackerz☆ █ ▇ ▆ ▅ ▄ ▃ ▂ ▁
 
HomeRegisterLog in
Announcement ! All registered users here, Please go to our new site @ http://pinoyextremehackerz.tk/ ..Thank you
This Webiste is Closed

Share | 
 

  D3D CROSSHAIR CODES...

Go down 
AuthorMessage
๖ۣۜмΣтαℓωσℓƒ
Administrator
Administrator
avatar

Posts : 17
Join date : 20/09/2013

PostSubject: D3D CROSSHAIR CODES...   Fri Sep 20, 2013 5:44 pm

Globals: (Top of Code)
Code:
#define PI 3.14159265//Defining what PI is. PI is a Circle
int CenterX = GetSystemMetrics( 0 ) / 2-1;//Gets screen X resolution then cutting it in half to get the center.
int CenterY = GetSystemMetrics( 1 ) / 2-1;//Gets screen Y resolution then cutting it in half to get the center.
LPDIRECT3DDEVICE9 pDevice;
ID3DXLine *pLine;
Basic Crosshair:

Notes: When you see "CenterX-15" it means CenterX Minus 15 pixels.
Code:
//FillRGB(XPosition,YPosition,Width,Height,Color);
Function:
void FillRGB( int x, int y, int w, int h, D3DCOLOR color, IDirect3DDevice9* pDevice )
{
   D3DRECT rec = { x, y, x + w, y + h };
   pDevice->Clear( 1, &rec, D3DCLEAR_TARGET, color, 0, 0 );
}
//Drawing it:
FillRGB(CenterX-15, CenterY, 30, 1,Red,pDevice);//Diagonal line
FillRGB(CenterX, CenterY-15, 1, 30,Red,pDevice);//Vertical line
Circle Crosshair:

Code:
//DrawCircle(XPosition,YPosition,Radius,numSides,Col  or);
[COLOR="DarkOrange"]Function:[/COLOR]
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();
}

// Drawing it:
DrawCircle(CenterX,CenterY,8,8,Red);
Dot Crosshair:
Notes: If you adjust the size you will have to adjust the position to suit.
Code:
Example:
 DrawPoint(CenterX-10,CenterY-10, 10, 10, Green);
 The size is now 10 so i -10 off the XY position to suit.
 

//DrawPoint(XPosition,YPosition,Width,Height,Color);
[COLOR="DarkOrange"]Function:[/COLOR]
void DrawPoint(int x, int y, int w, int h, DWORD color)
{
    FillRGB((int)x, (int)y, (int)w, (int)h, color);

}
[COLOR="DarkOrange"]Drawing it:[/COLOR]
DrawPoint(CenterX-1,CenterY-1, 1, 1, Green);
Cross(X) Crosshair:

Notes: XPosStart YPosStart starts the line and then XPosFinish
YPosFinish is where the line will be drawn too.
Code:
//DrawLine(XPosStart,YPosStart,XPosFinish,YPosFinish  ,Width,Color);
//Function:
void DrawLine(float x, float y, float x2, float y2, float width, DWORD color)
{
    D3DXVECTOR2 vLine[2];
    pLine->SetWidth( width );
    pLine->SetAntialias( false );
    pLine->SetGLLines( true );
    vLine[0].x = x;
    vLine[0].y = y;
    vLine[1].x = x2;
    vLine[1].y = y2;
    pLine->Begin();
    pLine->Draw( vLine, 2, color );
    pLine->End();
}
//Drawing it:
DrawLine(CenterX+10,CenterY+10,CenterX-10,CenterY-10,1,Red);
DrawLine(CenterX-10,CenterY+10,CenterX+10,CenterY-10,1,Red);

_________________
Back to top Go down
 
D3D CROSSHAIR CODES...
Back to top 
Page 1 of 1

Permissions in this forum:You cannot reply to topics in this forum
Pinoy Extreme Hackerz :: Programming :: D3D-
Jump to: