Cool[new source] drawing crosshair

Posts 1–3 of 3 · Page 1 of 1
[new source] drawing crosshair
here is an easy way to center a crosshair. d3d

thanks

Code:
//Globals 
  
  float ScreenCenterX = 0.0f;//Horizontal Position 
  float ScreenCenterY = 0.0f;//Vertical Position 
  bool crosshair = false; 
  D3DCOLOR redt = D3DCOLOR_XRGB( 255, 0, 0 ); 


//Add this SetViewport 

  ScreenCenterX = ( float )pViewport->Width / 2; 
  ScreenCenterY = ( float )pViewport->Height / 2; 

//Add this in EndScene 

        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); 
    }
only that?? That is a full hack???
Quote Originally Posted by Darko155 View Post
only that?? That is a full hack???
Well yes, a crosshair. All that is happening here is he is dividing the width and hight of your comp by 2, and finding where they meet. Then you have the center... And when your done with that, you can customize it.
Posts 1–3 of 3 · Page 1 of 1
This thread is closed for replies.

Tags for this Thread

Need help?