TalkingBasic D3D crosshair

Posts 1–9 of 9 · Page 1 of 1
Basic D3D crosshair
//Crosshair//
if(CH_CrossX==1)
{
int x = ( GetSystemMetrics( 0 ) / 2);
int y = ( GetSystemMetrics( 1 ) / 2);
D3DRECT rec = { x - 10, y, x + 10, y + 1};
D3DRECT rec2 = { x, y - 10, x + 1, y + 10};
pDevice->Clear(1, &rec, D3DCLEAR_TARGET, D3DCOLOR_ARGB(255, 255, 0, 0), 0, 0);
pDevice->Clear(1, &rec2, D3DCLEAR_TARGET, D3DCOLOR_ARGB(255, 255, 0, 0), 0, 0);
}

if(CH_CrossX== 2)
{
int x = ( GetSystemMetrics( 0 ) / 2);
int y = ( GetSystemMetrics( 1 ) / 2);
D3DRECT rec = { x - 10, y, x + 10, y + 1};
D3DRECT rec2 = { x, y - 10, x + 1, y + 10};
pDevice->Clear(1, &rec, D3DCLEAR_TARGET, D3DCOLOR_ARGB(255,0,0,255), 0, 0);
pDevice->Clear(1, &rec2, D3DCLEAR_TARGET, D3DCOLOR_ARGB(255,0,0,255), 0, 0);
}

if(CH_CrossX==3)
{
int x = ( GetSystemMetrics( 0 ) / 2);
int y = ( GetSystemMetrics( 1 ) / 2);
D3DRECT rec = { x - 10, y, x + 10, y + 1};
D3DRECT rec2 = { x, y - 10, x + 1, y + 10};
pDevice->Clear(1, &rec, D3DCLEAR_TARGET, D3DCOLOR_ARGB(255, 255, 255, 255), 0, 0);
pDevice->Clear(1, &rec2, D3DCLEAR_TARGET, D3DCOLOR_ARGB(255, 255, 255, 255), 0, 0);
}

if(CH_CrossX==4)
{
int x = ( GetSystemMetrics( 0 ) / 2);
int y = ( GetSystemMetrics( 1 ) / 2);
D3DRECT rec = { x - 10, y, x + 10, y + 1};
D3DRECT rec2 = { x, y - 10, x + 1, y + 10};
pDevice->Clear(1, &rec, D3DCLEAR_TARGET, D3DCOLOR_ARGB(255, 0, 255, 0), 0, 0);
pDevice->Clear(1, &rec2, D3DCLEAR_TARGET, D3DCOLOR_ARGB(255, 0, 255, 0), 0, 0);
}
amazing, thank you =)
Uhmm... OK? Should be in the snippets vault though and should be a in a code box.
Why not make a function instead of retyping all that

[Highlight=c++]

void xhair( LPDIRECT3DDEVICE9 pDevice, D3DCOLOR color)
{
int x = ( GetSystemMetrics( 0 ) / 2);
int y = ( GetSystemMetrics( 1 ) / 2);

D3DRECT rec = { x - 10, y, x + 10, y + 1};
D3DRECT rec2 = { x, y - 10, x + 1, y + 10};

pDevice->Clear(1, &rec, D3DCLEAR_TARGET, color, 0, 0);
pDevice->Clear(1, &rec2, D3DCLEAR_TARGET, color , 0, 0);
}

[/Highlight]
Fail copy and paste from combat arms sections. It needs a function... then the function declares the detail

(I.E. how tall or wide it is.... coordinates... color.. etc.)
can you guys make a full tutorial about it?
Quote Originally Posted by Devougn View Post
can you guys make a full tutorial about it?
Sure:


Download Microsoft vC++ 2010,

Copy and paste into a Base,

Learn c++ language.

/Done
Quote Originally Posted by CAFlames View Post

Sure:


Download Microsoft vC++ 2010,

Copy and paste into a Base,

Learn c++ language.

/Done
Whats a base?
Posts 1–9 of 9 · Page 1 of 1

Post a Reply

Tags for this Thread

None

Talk with us