Hello guys here is how to make a d3d crosshair enjoy.
this how you make a d3d crosshair you use the Starter kit or make your own one i suggest if your good at coding to make your own because the starter kit is well detected . here is the code
in Globals put this (Hint. in the top of your source code)
Code:
float ScreenCenterX = 0.0f;//Horizontal Position
float ScreenCenterY = 0.0f;//Vertical Position
bool crosshair = false;
D3DCOLOR redt = D3DCOLOR_XRGB( 255, 0, 0 );
next
in setviewport add this ( Hint: to find the set View port in starter kit press ctrl and f and serch setview port)
Code:
ScreenCenterX = ( float )pViewport->Width / 2;
ScreenCenterY = ( float )pViewport->Height / 2;
and add this in endsance( hint; you find this as well by pressing ctrl and f and typing the name )
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);
//Add hotkey
and this how you would add hotkeys
Code:
if (GetKeyState(VK_F4) &1)
{
//Code here
}
so it would be like
this
Code:
if (GetKeyState(VK_F4) &1) //<----- this don't need to be f4 it can be any button but rember Big later
{
Crosshair = ! crosshair
}
and rember to add this in the top as well
Code:
bool crosshair = false;
credits to me ( Ao Team) and I will show you how to make glass walls and more see you guys than
AND if you need any help write here
press thank!!!!
/