This site is no longer active, all members have migrated to devotedcheating.com . Thankyou



 
Actionhacks.net­Home­FAQ­Register­Log in
Post new topic   Reply to topicShare | 
 

 Creating a Rainbow Crosshair

View previous topic View next topic Go down 
AuthorMessage
Tate
Admin
Admin


Posts: 208
Reputation: 17
Join date: 2009-09-19
Age: 13

PostSubject: Creating a Rainbow Crosshair   Wed Nov 25, 2009 4:17 pm

This is a simple tutorial on how to make a Crosshair that is rainbow filled.


Add this at the top (under your includes)

Code:
 bool crosshair = false; 
  float ScreenCenterX = 0.0f;//Horizontal Position 
  float ScreenCenterY = 0.0f;//Vertical Position 


That determines the center of your screen.

Spoiler:
 



ALSO:

Add
Code:
#pragma warning(disable:4305) 
to the top with your includes to get rid of warnings.


Step 2:


If you are using the Starter Kit search "
Code:
HRESULT APIENTRY hkIDirect3DDevice9::SetViewport(CONST D3DVIEWPORT9 *pViewport) )
" If you aren't, go down to SetViewport.


Add this:
Code:
ScreenCenterX = ( float )pViewport->Width / 2;
      ScreenCenterY = ( float )pViewport->Height / 2; 



Step 3:

Finally, go to "EndScene" or
Code:
( HRESULT APIENTRY hkIDirect3DDevice9::EndScene() )


and type this:

Code:
if(crosshair)
    {
    D3DVIEWPORT9 viewP;
    m_pD3Ddev->GetViewport( &viewP );
    DWORD ScreenCenterX = viewP.Width / 2; 
    DWORD ScreenCenterY = viewP.Height / 2; 

    D3DRECT rec4 = {ScreenCenterX-35, ScreenCenterY, ScreenCenterX+ 35, ScreenCenterY+1};
    D3DRECT rec5 = {ScreenCenterX, ScreenCenterY-35, ScreenCenterX+ 1,ScreenCenterY+35}; 
    m_pD3Ddev->Clear( 1, &rec4, D3DCLEAR_TARGET, D3DXCOLOR(0.62745098, 0.125490, 0.959999, 1.0), 0,  0 );//purple
    m_pD3Ddev->Clear( 1, &rec5, D3DCLEAR_TARGET, D3DXCOLOR(0.62745098, 0.125490, 0.959999, 1.0), 0,  0 ); 

    D3DRECT rec6 = {ScreenCenterX-30, ScreenCenterY, ScreenCenterX+ 30, ScreenCenterY+1};
    D3DRECT rec7 = {ScreenCenterX, ScreenCenterY-30, ScreenCenterX+ 1,ScreenCenterY+30}; 
    m_pD3Ddev->Clear( 1, &rec6, D3DCLEAR_TARGET, D3DXCOLOR(0.0, 0.0, 1.0, 1.0), 0,  0 );//blue
    m_pD3Ddev->Clear( 1, &rec7, D3DCLEAR_TARGET, D3DXCOLOR(0.0, 0.0, 1.0, 1.0), 0,  0 ); 

    D3DRECT rec8 = {ScreenCenterX-25, ScreenCenterY, ScreenCenterX+ 25, ScreenCenterY+1};
    D3DRECT rec9 = {ScreenCenterX, ScreenCenterY-25, ScreenCenterX+ 1,ScreenCenterY+25}; 
    m_pD3Ddev->Clear( 1, &rec8, D3DCLEAR_TARGET, D3DXCOLOR(0.0, 1.0, 1.0, 1.0), 0,  0 );//cyan
    m_pD3Ddev->Clear( 1, &rec9, D3DCLEAR_TARGET, D3DXCOLOR(0.0, 1.0, 1.0, 1.0), 0,  0 );

    D3DRECT rec10 = {ScreenCenterX-20, ScreenCenterY, ScreenCenterX+ 20, ScreenCenterY+1};
    D3DRECT rec11 = {ScreenCenterX, ScreenCenterY-20, ScreenCenterX+ 1,ScreenCenterY+20}; 
    m_pD3Ddev->Clear( 1, &rec10, D3DCLEAR_TARGET, D3DXCOLOR(0.0, 1.0, 0.0, 1.0), 0,  0 );// green
    m_pD3Ddev->Clear( 1, &rec11, D3DCLEAR_TARGET, D3DXCOLOR(0.0, 1.0, 0.0, 1.0), 0,  0 );

    D3DRECT rec12 = {ScreenCenterX-15, ScreenCenterY, ScreenCenterX+ 15, ScreenCenterY+1};
    D3DRECT rec13 = {ScreenCenterX, ScreenCenterY-15, ScreenCenterX+ 1,ScreenCenterY+15}; 
    m_pD3Ddev->Clear( 1, &rec12, D3DCLEAR_TARGET, D3DXCOLOR(1.0, 1.0, 0.0, 1.0), 0,  0 );// yellow
    m_pD3Ddev->Clear( 1, &rec13, D3DCLEAR_TARGET, D3DXCOLOR(1.0, 1.0, 0.0, 1.0), 0,  0 );
   
    D3DRECT rec14 = {ScreenCenterX-10, ScreenCenterY, ScreenCenterX+ 10, ScreenCenterY+1};
    D3DRECT rec15 = {ScreenCenterX, ScreenCenterY-10, ScreenCenterX+ 1,ScreenCenterY+10}; 
    m_pD3Ddev->Clear( 1, &rec14, D3DCLEAR_TARGET, D3DXCOLOR(1.0, 0.549019608, 0.0, 1.0), 0,  0 );// orange
    m_pD3Ddev->Clear( 1, &rec15, D3DCLEAR_TARGET, D3DXCOLOR(1.0, 0.549019608, 0.0, 1.0), 0,  0 );

    D3DRECT rec16 = {ScreenCenterX-5, ScreenCenterY, ScreenCenterX+ 5, ScreenCenterY+1};
    D3DRECT rec17 = {ScreenCenterX, ScreenCenterY-5, ScreenCenterX+ 1,ScreenCenterY+5}; 
    m_pD3Ddev->Clear( 1, &rec16, D3DCLEAR_TARGET, D3DXCOLOR(1.0, 0.0, 0.0, 1.0), 0,  0 );//red
    m_pD3Ddev->Clear( 1, &rec17, D3DCLEAR_TARGET, D3DXCOLOR(1.0, 0.0, 0.0, 1.0), 0,  0 );



[code]

_________________
"Never pick a fight with an idiot. They'll simply bring you down to their level, then win by experience."
___________________________________
Back to top Go down
TheFallen
General Member
General Member


Posts: 8
Reputation: 0
Join date: 2009-10-21

PostSubject: Re: Creating a Rainbow Crosshair   Thu Nov 26, 2009 3:33 am

still copying and pasting awwww
and theres a much easier way to do this -.-
Back to top Go down
Tate
Admin
Admin


Posts: 208
Reputation: 17
Join date: 2009-09-19
Age: 13

PostSubject: Re: Creating a Rainbow Crosshair   Thu Nov 26, 2009 4:03 am

TheFallen wrote:
still copying and pasting awwww
and theres a much easier way to do this -.-



Yeah.

Because I'm an openGL maniac now.

This is just a tut by dante

_________________
"Never pick a fight with an idiot. They'll simply bring you down to their level, then win by experience."
___________________________________
Back to top Go down
TheFallen
General Member
General Member


Posts: 8
Reputation: 0
Join date: 2009-10-21

PostSubject: Re: Creating a Rainbow Crosshair   Thu Nov 26, 2009 1:04 pm

Open GL sucks
Back to top Go down
Tate
Admin
Admin


Posts: 208
Reputation: 17
Join date: 2009-09-19
Age: 13

PostSubject: Re: Creating a Rainbow Crosshair   Fri Nov 27, 2009 12:21 am

TheFallen wrote:
Open GL sucks


Not really.

It has far more capabilities, and is supported by more MAJOR games (That means like halo, and other big games, not crossfire.)

It's also a different concept than d3d, and I find it easier to understand, and to build a hack with.

_________________
"Never pick a fight with an idiot. They'll simply bring you down to their level, then win by experience."
___________________________________
Back to top Go down
 

Creating a Rainbow Crosshair

View previous topic View next topic Back to top 
Page 1 of 1

Permissions of this forum:You cannot reply to topics in this forum
 :: Public Section: Coding :: D3D :: Tutorials-
Post new topic   Reply to topic