Page 1 of 6 123 ... LastLast
Results 1 to 15 of 80
  1. #1
    ★Rusty's Avatar
    Join Date
    Aug 2010
    Gender
    male
    Location
    My House/CShell Codes: C++
    Posts
    111
    Reputation
    14
    Thanks
    297
    My Mood
    Psychedelic

    [Tutorial] D3D Crosshairs

    D3D Crosshairs

    Ive seen the same basic/boring crosshair in public hacks and not many threads on how to do crosshairs.
    So i thought id share how to create different styles.
    Many of you may already know how to do this im just helping out the noobs.
    If you don't understand something just post and i will try and help.
    Enjoy

    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:
    [IMG]https://i238.photobucke*****m/albums/ff101/wes0001/4.jpg[/IMG]
    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:
    [IMG]https://i238.photobucke*****m/albums/ff101/wes0001/1.jpg[/IMG]

    Code:
    //DrawCircle(XPosition,YPosition,Radius,numSides,Color);
    Function:
    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:
    [IMG]https://i238.photobucke*****m/albums/ff101/wes0001/5.jpg[/IMG]
    Notes:
    If you adjust the size you will have to adjust the position to suit.
    Example:
    DrawPoint(CenterX-10,CenterY-10, 10, 10, Green);
    The size is now 10 so i -10 off the XY position to suit.
    Code:
    //DrawPoint(XPosition,YPosition,Width,Height,Color);
    Function:
    void DrawPoint(int x, int y, int w, int h, DWORD color)
    {
        FillRGB((int)x, (int)y, (int)w, (int)h, color);
    
    } 
    Drawing it:
    DrawPoint(CenterX-1,CenterY-1, 1, 1, Green);
    Cross Crosshair:
    [IMG]https://i238.photobucke*****m/albums/ff101/wes0001/3.jpg[/IMG]
    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);
    Now that we have the main ones you can start merging them and making your own ones.
    You have all the functions so ill just give your a picture and the drawing code.
    [IMG]https://i238.photobucke*****m/albums/ff101/wes0001/6.jpg[/IMG]
    Code:
    DrawCircle(CenterX,CenterY,8,8,Red);//Circle
    FillRGB(CenterX-17, CenterY, 10, 1,Red,pDevice);//Left line
    FillRGB(CenterX+9, CenterY, 10, 1,Red,pDevice); // Right line
    FillRGB(CenterX, CenterY-17, 1, 10,Red,pDevice);//Top line
    FillRGB(CenterX, CenterY+9, 1, 10,Red,pDevice);//Bottom line
    DrawPoint(CenterX, CenterY, 1, 1, Green);//Dot point
    [IMG]https://i238.photobucke*****m/albums/ff101/wes0001/7.jpg[/IMG]
    Code:
    FillRGB(CenterX-15, CenterY, 10, 1,Red,pDevice);//Left line
    FillRGB(CenterX+6, CenterY, 10, 1,Red,pDevice);//Right line
    FillRGB(CenterX, CenterY-15, 1, 10,Red,pDevice);//Top line
    FillRGB(CenterX, CenterY+6, 1, 10,Red,pDevice);//Bottom line
    DrawPoint(CenterX-1 , CenterY-1, 1, 1, Green);//Dot point
    [IMG]https://i238.photobucke*****m/albums/ff101/wes0001/8.jpg[/IMG]
    Code:
    DrawCircle(CenterX-1,CenterY-1,8,8,Red);//Circle
    FillRGB(CenterX-13, CenterY, 10, 1,Red,pDevice);//Left line
    FillRGB(CenterX+4, CenterY, 10, 1,Red,pDevice);//Right line
    FillRGB(CenterX, CenterY-13, 1, 10,Red,pDevice);//Top line
    FillRGB(CenterX, CenterY+4, 1, 10,Red,pDevice);//Bottom line
    DrawPoint(CenterX-1 , CenterY-1, 1, 1, Green);//Dot point
    [IMG]https://i238.photobucke*****m/albums/ff101/wes0001/9.jpg[/IMG]
    Code:
    DrawLine(CenterX+15,CenterY+15,CenterX+3,CenterY+3,2,Red);// Bottom right to center
    DrawLine(CenterX-15,CenterY+15,CenterX-3,CenterY+3,2,Red);//Bottom left to center
    DrawLine(CenterX+15,CenterY-15,CenterX+3,CenterY-3,2,Red);//Top right to center
    DrawLine(CenterX-15,CenterY-15,CenterX-3,CenterY-3,2,Red);//Top left to center
    DrawPoint(CenterX,CenterY,1,1,Green);//Dot point
    [IMG]https://i238.photobucke*****m/albums/ff101/wes0001/10.jpg[/IMG]
    Code:
    FillRGB(CenterX-20, CenterY, 40, 1,Purple,pDevice);//Purple
    FillRGB(CenterX, CenterY-20, 1, 40,Purple,pDevice);
    
    FillRGB(CenterX-17, CenterY, 34, 1,Blue,pDevice);//Blue
    FillRGB(CenterX, CenterY-17, 1, 34,Blue,pDevice);
    
    FillRGB(CenterX-14, CenterY, 28, 1,Cyan,pDevice);//Cyan
    FillRGB(CenterX, CenterY-14, 1, 28,Cyan,pDevice);
    
    FillRGB(CenterX-11, CenterY, 22, 1,Green,pDevice);//Green
    FillRGB(CenterX, CenterY-11, 1, 22,Green,pDevice);
    
    FillRGB(CenterX-9, CenterY, 18, 1,Yellow,pDevice);//Yellow
    FillRGB(CenterX, CenterY-9, 1, 18,Yellow,pDevice);
    
    FillRGB(CenterX-6, CenterY, 12, 1,Orange,pDevice);//Orange
    FillRGB(CenterX, CenterY-6, 1, 12,Orange,pDevice);
    
    FillRGB(CenterX-3, CenterY, 6, 1,Red,pDevice);//Red
    FillRGB(CenterX, CenterY-3, 1, 6,Red,pDevice);


    Credits:
    ★Rusty
    ac1d_buRn - Some Functions
    CodeDemon - Some Functions
    Other people(dont know who) - Some Functions
    Last edited by Jabuuty671; 10-14-2010 at 02:17 AM.

  2. The Following 56 Users Say Thank You to ★Rusty For This Useful Post:

    1on1 (10-20-2010),39killers (10-23-2010),Amatowarrior (10-13-2010),Anubiset (10-23-2010),[MPGH]AVGN (10-13-2010),baraozin (06-05-2011),bodziec12 (09-12-2014),cosconub (10-13-2010),Decoder Member (04-23-2011),Dieorwin (10-30-2010),Donor (06-15-2013),dontcrymore15 (10-13-2010),Drake (02-09-2011),Falingrave (10-14-2010),FckH4c0R (01-23-2011),Fellipectr³ (05-08-2012),flameswor10 (10-13-2010),[MPGH]Flengo (06-03-2011),Fog~On (02-06-2011),fuked (12-06-2010),fvestrgenrl (10-13-2010),HaX4LiFe! (10-14-2010),House.m.d. (02-09-2011),Houston (01-25-2011),Iplay4elite (11-21-2010),koolwrench (10-13-2010),Maroon5. (05-22-2013),matv3y (04-06-2015),matypatty (06-20-2013),MegaR (09-27-2011),mrcolls (10-25-2010),n4n033 (02-18-2011),Nightmare (06-28-2012),NOOB (10-13-2010),o-o (10-13-2010),OpKilts (06-28-2013),pDevice (06-28-2012),postovan (10-20-2010),Racism (03-03-2011),roberto1231 (10-14-2010),S0aD (01-27-2011),sanusbaum (07-05-2014),sh00ter (11-24-2010),shameless247 (02-05-2011),Stephen (10-13-2010),streetBackup (05-31-2012),supercarz1991 (02-01-2011),Synchromanica (02-11-2011),tahha (10-14-2010),teoyzaa (07-18-2012),TheMiddle (06-03-2011),UGodly (10-13-2010),uzi177 (01-24-2011),yaserifti1 (02-18-2011),zigi (11-29-2010),[G]a[M]e[R] (08-01-2011)

  3. #2
    Physcadelic's Avatar
    Join Date
    Aug 2010
    Gender
    male
    Location
    Australia <3
    Posts
    4,450
    Reputation
    323
    Thanks
    828
    My Mood
    Breezy
    Nice.
    It's nice to see a crosshair tut.

    R.I.P a great GM




    Quote Originally Posted by Assalamu alaikum View Post
    what? maybe stop talk with riddles and with words i am not even know.

  4. #3
    ac1d_buRn's Avatar
    Join Date
    Aug 2009
    Gender
    female
    Location
    CA Source Section
    Posts
    3,404
    Reputation
    157
    Thanks
    4,003
    My Mood
    Flirty
    Looks good.

  5. #4
    Mr.Magicman's Avatar
    Join Date
    Sep 2009
    Gender
    male
    Location
    Sitting in my cave full of thoughts learning Asembly
    Posts
    2,102
    Reputation
    16
    Thanks
    649
    My Mood
    Cold
    Good tutorial but explain to the unknowing what you are doing instead of just supplying code...

    Like tell them what GetSystemMetrics realy do its just a tip

  6. The Following User Says Thank You to Mr.Magicman For This Useful Post:

    ★Rusty (10-13-2010)

  7. #5
    wassup40's Avatar
    Join Date
    Jun 2010
    Gender
    male
    Location
    I dont know help me
    Posts
    2,238
    Reputation
    28
    Thanks
    790
    My Mood
    Lurking
    Wow amazing tut thank's dude.

  8. #6
    Jązzą_'s Avatar
    Join Date
    Sep 2009
    Gender
    male
    Posts
    185
    Reputation
    11
    Thanks
    97
    My Mood
    Cool
    Great tut interesting...


    Applications:
    Jązzą InjectXD | Radio♫ v1.1 | File Name Sorter
    Better than Bombsaway707 Radio (:

  9. #7
    freedompeace's Avatar
    Join Date
    Jul 2010
    Gender
    female
    Posts
    3,033
    Reputation
    340
    Thanks
    2,792
    My Mood
    Sad
    Quote Originally Posted by Mr.Magicman View Post
    Good tutorial but explain to the unknowing what you are doing instead of just supplying code...

    Like tell them what GetSystemMetrics realy do its just a tip
    They can Google it. It's not that hard - it's actually incredibly easy D:

  10. #8
    seeplusplus's Avatar
    Join Date
    Sep 2010
    Gender
    male
    Location
    Massachusetts
    Posts
    329
    Reputation
    8
    Thanks
    85
    I was going to call you a leecher, but then I saw the credits. Great post!
    Goals:
    Green = Done
    Blue = Getting Somewhere
    Red = Not Done
    • Mouse Grid
    • PTC Method
    • Trigger Bot

    I'm trying to think of more stuff!

  11. #9
    Sydney's Avatar
    Join Date
    Mar 2010
    Gender
    male
    Location
    Germany...
    Posts
    1,356
    Reputation
    37
    Thanks
    1,144
    My Mood
    Amused
    Some fails in there.Its at the wrong pos. And there are many pDevice errors.

    Thanks Cosmos


  12. #10
    inliner's Avatar
    Join Date
    Jun 2008
    Gender
    male
    Location
    d
    Posts
    64
    Reputation
    10
    Thanks
    11
    wow thanks this tut looks great maybe ill add some new crosshairs to my hack

  13. #11
    Stephen's Avatar
    Join Date
    Jun 2009
    Gender
    male
    Location
    Engine.exe
    Posts
    4,689
    Reputation
    184
    Thanks
    1,149
    My Mood
    Aggressive
    Now, /me doesnt have to write it out

  14. #12
    Amatowarrior's Avatar
    Join Date
    Sep 2009
    Gender
    male
    Posts
    629
    Reputation
    14
    Thanks
    102
    My Mood
    Inspired
    Finally! A tutorial for this! Thank you!
    Tools UNDETECTED - PATCHED [I will only have recent versions up!]
    Tapper V1.15: https://www.mpgh.net/forum/164-combat...r-v1-15-a.html
    Amato Inject V1.15: https://www.mpgh.net/forum/292-combat...t-v1-15-a.html

    Mods
    L96A1 - Arctic Wolf
    Super M416 CQB
    Super M16A3
    MW2 M92FS (M9)
    Starcraft 2 L96A1

    PVT VIP
    Aimbot: 65% (Have full source code)
    OPK: 100% (Uses Enemy Class)
    Telekill: 100% (Uses Enemy Class)
    Ghost Mode: 80% (In Semi-Stages)
    Super Bullets: 100% (Thanks Deadlinez/hahaz!)
    Menu Sprite: 100% (Thanks whit!)



  15. #13
    UGodly's Avatar
    Join Date
    Sep 2010
    Gender
    male
    Location
    https://www.mpgh.net/forum/members/645501-ugodly.html
    Posts
    1,234
    Reputation
    18
    Thanks
    160
    My Mood
    Yeehaw
    very nice tut will try it on my other hack

  16. #14
    dontcrymore15's Avatar
    Join Date
    Aug 2010
    Gender
    male
    Location
    Honduras....
    Posts
    72
    Reputation
    10
    Thanks
    26
    My Mood
    Angelic
    Wo0w Thank Rusty, Good JOB::::!!! :@

  17. #15
    Disturbed's Avatar
    Join Date
    Feb 2009
    Gender
    male
    Posts
    10,472
    Reputation
    1267
    Thanks
    2,587
    Not really a tutorial, more like source code.

    Tutorial for people who know what they are doing.


Page 1 of 6 123 ... LastLast

Similar Threads

  1. [Release] D3D Crosshair V3.0 - (Uprade + Release)
    By AeroMan in forum WarRock - International Hacks
    Replies: 27
    Last Post: 02-20-2010, 12:43 PM
  2. [Release] [Undetected] D3D Crosshair
    By AeroMan in forum WarRock - International Hacks
    Replies: 79
    Last Post: 02-16-2010, 01:05 PM
  3. [Release] My New D3D Crosshair SOURCECODE
    By HerrArkanes in forum CrossFire Hacks & Cheats
    Replies: 28
    Last Post: 12-22-2009, 09:40 PM
  4. A vidtut for d3d crosshairs?
    By Lolland in forum Programming Tutorial Requests
    Replies: 1
    Last Post: 10-06-2009, 09:59 AM
  5. d3d crosshair
    By qsc in forum C++/C Programming
    Replies: 17
    Last Post: 06-22-2009, 12:57 PM