Thread: D3D CrossHair

Page 1 of 2 12 LastLast
Results 1 to 15 of 19
  1. #1
    PashaAmd's Avatar
    Join Date
    Mar 2011
    Gender
    male
    Posts
    1,014
    Reputation
    58
    Thanks
    224

    Smile D3D CrossHair

    Hi guys I decided to make a tutorial for all those noobs that want to be 1337 haxor like me ...well I'm not going to hold your hand through it completely...I will add some errors and you should figure them out (: make you think o:

    I recommend getting the D3D9 StarterKit... Anyways under "Globals" (*cough* top of code *cough*) put:
    Code:
      float ScreenCenterX = 0.0f; //Horizontal Position 
      float ScreenCenterY = 0.0f; //Vertical Position  
      bool crosshair = false; //to see wether you want it on or off (set to "off")
      D3DCOLOR redt = D3DCOLOR_XRGB( 255, 0, 0 ); // Your color...
    Next, in SetViewPort add this ( Hint: to find the SetViewPort easily in the starter kit press "ctrl + f" and search for SetViewPort)
    Code:
              ScreenCenterx = ( float )pViewport->Width / 2; 
              ScreenCenterY = ( float )pViewport->Height / 2
    Step 2: add this in "EndScene"( hint: you can find this like you did with SetViewPort by pressing "ctrl + f" and typing EndScene )
    Code:
    if(crosshair) 
         {  
           D3DRECT rec2 = {ScreenCenterX-20, ScreenCenterY, ScreenCenterX+ 20, ScreenCenterY+2}; 
           D3DRECT rec3 = {ScreenCenterX, ScreenCenterY-20, ScreenCenterX+ 2,ScreenCenterY+20}; 
                                      
        m_pD3Ddev->Clear(1, &rec2, D3DCLEAR_TARGET,redt, 0,  0); 
        m_pD3Ddev->Clear(1, &rec3, D3DCLEAR_TARGET,redt, 0,  0);
    Now to add hotkeys...this is used to turn your hack on or off

    Code:
    if (GetAsyncKeyState(VK_NUMPAD0) & 1 )          //<----- this doesn't have to be NumberPad 0 it can be anything you want 
    {
       Crosshair =! crosshair 
    }
    If you have any problems...(other than the ones I put there on purpose) put it in the comments

    + Thanks if I helped!!!

  2. #2
    flameswor10's Avatar
    Join Date
    Jul 2009
    Gender
    male
    Posts
    12,528
    Reputation
    981
    Thanks
    10,404
    My Mood
    In Love
    Code:
    void DrawCrosshair(LPDIRECT3DDEVICE9 pDevice)
    {
    	switch(fHack.xHair)
    	{
    	case 1:
    		Crosshair(pDevice, WHITE);
    		break;
    	case 2:
    		Crosshair(pDevice, RED);
    		break;
    	case 3:
    		Crosshair(pDevice, GREEN);
    		break;
    	case 4:
    		Crosshair(pDevice, BLUE);
    		break;
    	case 5:
    		Crosshair(pDevice, BLACK);
    		break;
    	case 6:
    		Crosshair(pDevice, PURPLE);
    		break;
    	case 7:
    		Crosshair(pDevice, GREY);
    		break;
    	case 8:
    		Crosshair(pDevice, YELLOW);
    		break;
    	case 9:
    		Crosshair(pDevice, ORANGE);
    		break;
    	}
    }
    Code:
    void RenderFrame(LPDIRECT3DDEVICE9 pDevice)
    {
    //Hacks Here
    	DrawCrosshair(pDevice);
    }
    Code:
    void Crosshair(LPDIRECT3DDEVICE9 pDevice, D3DCOLOR Color)
    {
    		int size = 9, 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 rec_a = { iCenterX - size, iCenterY, iCenterX + size, iCenterY + strong};
    		D3DRECT rec_b = { iCenterX, iCenterY - size, iCenterX + strong,iCenterY + size};
    		pDevice->Clear(1, &rec_a, D3DCLEAR_TARGET, Color, 0,  0);
    		pDevice->Clear(1, &rec_b, D3DCLEAR_TARGET, Color, 0,  0);
    }
    Code:
    Code:
    if (GetAsyncKeyState(VK_NUMPAD0) &1 ) 
    {
       fHack.xHair ++;
       if(fHack.xHair == 10)fHack.xHair = 0;
    }
    simplistic way
    }
    No I do not make game hacks anymore, please stop asking.


    Been MPGH Minion: 6 July 2011 - 1 August 2012

  3. #3
    PashaAmd's Avatar
    Join Date
    Mar 2011
    Gender
    male
    Posts
    1,014
    Reputation
    58
    Thanks
    224
    Quote Originally Posted by flameswor10 View Post
    Code:
    void DrawCrosshair(LPDIRECT3DDEVICE9 pDevice)
    {
    	switch(fHack.xHair)
    	{
    	case 1:
    		Crosshair(pDevice, WHITE);
    		break;
    	case 2:
    		Crosshair(pDevice, RED);
    		break;
    	case 3:
    		Crosshair(pDevice, GREEN);
    		break;
    	case 4:
    		Crosshair(pDevice, BLUE);
    		break;
    	case 5:
    		Crosshair(pDevice, BLACK);
    		break;
    	case 6:
    		Crosshair(pDevice, PURPLE);
    		break;
    	case 7:
    		Crosshair(pDevice, GREY);
    		break;
    	case 8:
    		Crosshair(pDevice, YELLOW);
    		break;
    	case 9:
    		Crosshair(pDevice, ORANGE);
    		break;
    	}
    }
    Code:
    void RenderFrame(LPDIRECT3DDEVICE9 pDevice)
    {
    //Hacks Here
    	DrawCrosshair(pDevice);
    }
    Code:
    void Crosshair(LPDIRECT3DDEVICE9 pDevice, D3DCOLOR Color)
    {
    		int size = 9, 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 rec_a = { iCenterX - size, iCenterY, iCenterX + size, iCenterY + strong};
    		D3DRECT rec_b = { iCenterX, iCenterY - size, iCenterX + strong,iCenterY + size};
    		pDevice->Clear(1, &rec_a, D3DCLEAR_TARGET, Color, 0,  0);
    		pDevice->Clear(1, &rec_b, D3DCLEAR_TARGET, Color, 0,  0);
    }
    Code:
    Code:
    if (GetAsyncKeyState(VK_NUMPAD0) &1 ) 
    {
       fHack.xHair ++;
       if(fHack.xHair == 10)fHack.xHair = 0;
    }
    simplistic way
    }
    wow that slaps on mine

  4. #4
    flameswor10's Avatar
    Join Date
    Jul 2009
    Gender
    male
    Posts
    12,528
    Reputation
    981
    Thanks
    10,404
    My Mood
    In Love
    Quote Originally Posted by PashaAmd View Post
    wow that slaps on mine
    At least you are learning
    No I do not make game hacks anymore, please stop asking.


    Been MPGH Minion: 6 July 2011 - 1 August 2012

  5. The Following User Says Thank You to flameswor10 For This Useful Post:

    PashaAmd (03-13-2011)

  6. #5
    apeh0001's Avatar
    Join Date
    Mar 2011
    Gender
    male
    Location
    Endeaner
    Posts
    1
    Reputation
    10
    Thanks
    0
    HEY GUYS WHAT ARE THESE CODES FOR ?
    WHERE DO WE PUT THEM ?
    PLEASE HELP

  7. #6
    PashaAmd's Avatar
    Join Date
    Mar 2011
    Gender
    male
    Posts
    1,014
    Reputation
    58
    Thanks
    224
    Quote Originally Posted by apeh0001 View Post
    HEY GUYS WHAT ARE THESE CODES FOR ?
    WHERE DO WE PUT THEM ?
    PLEASE HELP
    you make a crosshiar that overlaps the game.... get the d3d starter kit..

  8. #7
    skyhigh2323's Avatar
    Join Date
    Mar 2011
    Gender
    male
    Posts
    3
    Reputation
    10
    Thanks
    1
    wow thanks man nice work

  9. #8
    CAFlames's Avatar
    Join Date
    Jan 2010
    Gender
    male
    Location
    Where ever my imagination takes me
    Posts
    3,014
    Reputation
    202
    Thanks
    2,934
    My Mood
    Twisted
    Mines simpler than all yours :P Search it.

    Glad you no how to copy and paste, bro.

    Current Works:
    ---Horror Game






    Special thanks to drgnforce9 for my sig picture

    Quote Originally Posted by m_t_h View Post

    CAflames is one epic coder.

    Rep and thanks him.. or you're perma banned.

  10. #9
    CodeDemon's Avatar
    Join Date
    Jul 2010
    Gender
    male
    Location
    vagina
    Posts
    1,074
    Reputation
    50
    Thanks
    936
    My Mood
    Fine
    Code:
    void DrawCrosshair(float len, int r, int g, int b, LPDIRECT3DDEVICE9 pDevice){
    	/* By CodeDemon */
    	D3DVIEWPORT9 screenPort;
    	pDevice->GetViewport(&screenPort);
    
    	D3DDraw.DrawLine((screenPort.Width/2), (screenPort.Height/2)-(len/2), (screenPort.Width/2), (screenPort.Height/2)+(len/2), 
    		r, g, b, 255); //vertical line
    	
    	D3DDraw.DrawLine((screenPort.Width/2)-(len/2), (screenPort.Height/2), (screenPort.Width/2)+(len/2), (screenPort.Height/2),
    		r, g, b, 255); // horizontal line
    }
    Thats mine It works.

  11. #10
    _Fk127_'s Avatar
    Join Date
    Nov 2010
    Gender
    male
    Posts
    724
    Reputation
    16
    Thanks
    208
    My Mood
    Bitchy
    class crosshair{
    class red{
    class small{
    void draw();
    }
    class big{
    void draw();
    }
    }
    class green... etc



    BEST WAY EVAR



    Put this image in your signature if you support HTML5 development!

  12. #11
    whit's Avatar
    Join Date
    Jan 2010
    Gender
    male
    Posts
    7,170
    Reputation
    490
    Thanks
    2,252
    Quote Originally Posted by _Fk127_ View Post
    class crosshair{
    class red{
    class small{
    void draw();
    }
    class big{
    void draw();
    }
    }
    class green... etc



    BEST WAY EVAR
    class within class within another class..
    Thats Pretty pro

  13. The Following User Says Thank You to whit For This Useful Post:

    PashaAmd (04-03-2011)

  14. #12
    topblast's Avatar
    Join Date
    Mar 2010
    Gender
    male
    Location
    Far from around you Programmer: C++ | VB | C# | JAVA
    Posts
    3,607
    Reputation
    149
    Thanks
    4,922
    My Mood
    Cool
    Quote Originally Posted by whit View Post
    class within class within another class..
    Thats Pretty pro
    omg, If he gets that code to compile and work without adding anything... I like my ass.
    I just like programming, that is all.

    Current Stuff:

    • GPU Programmer (Cuda)
    • Client/Server (Cloud Server)
    • Mobile App Development

  15. #13
    _Fk127_'s Avatar
    Join Date
    Nov 2010
    Gender
    male
    Posts
    724
    Reputation
    16
    Thanks
    208
    My Mood
    Bitchy
    Quote Originally Posted by whit View Post
    class within class within another class..
    Thats Pretty pro
    I like to roll 5-in-1...
    Thata just how i am



    Put this image in your signature if you support HTML5 development!

  16. #14
    topblast's Avatar
    Join Date
    Mar 2010
    Gender
    male
    Location
    Far from around you Programmer: C++ | VB | C# | JAVA
    Posts
    3,607
    Reputation
    149
    Thanks
    4,922
    My Mood
    Cool
    Quote Originally Posted by _Fk127_ View Post
    I like to roll 5-in-1...
    Thata just how i am
    TROLL
    I just like programming, that is all.

    Current Stuff:

    • GPU Programmer (Cuda)
    • Client/Server (Cloud Server)
    • Mobile App Development

  17. #15
    _Fk127_'s Avatar
    Join Date
    Nov 2010
    Gender
    male
    Posts
    724
    Reputation
    16
    Thanks
    208
    My Mood
    Bitchy
    Quote Originally Posted by topblast View Post


    TROLL
    Hacks.crosshair.red.big.circles.xhair2.draw();



    Put this image in your signature if you support HTML5 development!

Page 1 of 2 12 LastLast