Strikex (03-09-2011)
Hey, so this is basically a code for much simpler crosshairs...
In Globals:
Code:ID3DXLine *pLine;
My Crosshair Function:
Code:void CrossHair ( DWORD Size, D3DCOLOR Color ) { D3DXVECTOR2 vLine[ 5 ]; //# of points pLine->SetAntialias( 0 ); pLine->SetWidth( 1 ); // 1 Pixel width for XHair pLine->Begin(); vLine[ 0 ][ 0 ] = GetSystemMetrics( 0 ) / 2 - Size; vLine[ 0 ][ 1 ] = GetSystemMetrics( 1 ) / 2; vLine[ 1 ][ 0 ] = GetSystemMetrics( 0 ) / 2 + Size; vLine[ 1 ][ 1 ] = GetSystemMetrics( 1 ) / 2; vLine[ 2 ][ 0 ] = GetSystemMetrics( 0 ) / 2; vLine[ 2 ][ 1 ] = GetSystemMetrics( 1 ) / 2; vLine[ 3 ][ 0 ] = GetSystemMetrics( 0 ) / 2; vLine[ 3 ][ 1 ] = GetSystemMetrics( 1 ) / 2 + Size; vLine[ 4 ][ 0 ] = GetSystemMetrics( 0 ) / 2; vLine[ 4 ][ 1 ] = GetSystemMetrics( 1 ) / 2 - Size; //Drawing Crosshair pLine->Draw( vLine, 5, Color ); // Draw Line, # of points {(left to right, right to center, center to down, down to up) = 5}, Color pLine->End(); // finish }
Then Create the line like a font (Creditz to kotentopf):
Code:void SetLine(LPDIRECT3DDEVICE9 pDevice) { if(pLine == NULL ){ D3DXCreateLine(pDevice,&pLine); }else{ if (g_pDevice2 != pDevice) { g_pDevice2 = pDevice; try { if (pLine != 0) pLine->Release(); } catch (...) {} pLine = 0; D3DXCreateLine(pDevice,&pLine); }} }
Then to Actually make the crosshairs:
The Size is how big the crosshairs are... i.e. how wide and tall it is.Code:CrossHair ( Size, Color );
The color is just a D3DColor.
Ex of my crosshairs:
Thanks guys.Code:CrossHair ( 15, Red );
Strikex (03-09-2011)
The Internet SHOULD Be Illegal
When you say
"Java is a great programming language because it works on all platforms"
it is just like
"anal sex is great because it works on all genders"
Are YOU a Troll?
Good release. Common D3D knowledge though :/
@kotentopf
And what would be the best way of doing that?
@Zane Slayman
This is for those that dont want to figure out hieghts, widths, placements and stuff... so all you have t put is size and color
how i said it, create it like fontCode:void c3DMisc::SetLine(LPDIRECT3DDEVICE9 pDevice) { if( D3D.Settings.pLine == NULL ){ D3DXCreateLine(pDevice,&D3D.Settings.pLine); }else{ if (g_pDevice2 != pDevice) { g_pDevice2 = pDevice; try { if (D3D.Settings.pLine != 0) D3D.Settings.pLine->Release(); } catch (...) {} D3D.Settings.pLine = 0; D3DXCreateLine(pDevice,&D3D.Settings.pLine); }} }
The Internet SHOULD Be Illegal
When you say
"Java is a great programming language because it works on all platforms"
it is just like
"anal sex is great because it works on all genders"
Are YOU a Troll?
The Internet SHOULD Be Illegal
When you say
"Java is a great programming language because it works on all platforms"
it is just like
"anal sex is great because it works on all genders"
Are YOU a Troll?
nice release,
I will test to see if it will work on CABR