Kamis, 17 November 2011

[Masakazu] D3D Crosshairs

Globals: Langsung aja sisipkan dengan D3D menu kalian..... :D


Quote
#define PI 3.14159265//Defining what PI is. PI is a Circle int CenterX = GetSystemMetrics( 0 ) / 2-1;//Gets screen X resolution then cutting it in half to get the center.int CenterY = GetSystemMetrics( 1 ) / 2-1;//Gets screen Y resolution then cutting it in half to get the center.LPDIRECT3DDEVICE9 pDevice;ID3DXLine *pLine;


NB:Bila Anda melihat "CenterX-15" berarti CenterX Minus 15 piksel

Basic Crosshair:

uploads/monthly_07_2011/post-14872-021584800%201311069555_thumb.jpg


Code

Quote
//FillRGB(XPosition,YPosition,Width,Height,Color);Function:void FillRGB( int x, int y, int w, int h, D3DCOLOR color, IDirect3DDevice9* pDevice ){ D3DRECT rec = { x, y, x + w, y + h }; pDevice->Clear( 1, &rec, D3DCLEAR_TARGET, color, 0, 0 );}//Drawing it:FillRGB(CenterX-15, CenterY, 30, 1,Red,pDevice);//Diagonal lineFillRGB(CenterX, CenterY-15, 1, 30,Red,pDevice);//Vertical line


Circle Crosshair:


uploads/monthly_07_2011/post-14872-020145300%201311069900_thumb.jpg

Code

Quote
//DrawCircle(XPosition,YPosition,Radius,numSides,Col or);Function:void DrawCircle(int X, int Y, int radius, int numSides, DWORD Color) { D3DXVECTOR2 Line[128]; float Step = PI * 2.0 / numSides; int Count = 0; for (float a=0; a < PI*2.0; a += Step) { float X1 = radius * cos(a) + X; float Y1 = radius * sin(a) + Y; float X2 = radius * cos(a+Step) + X; float Y2 = radius * sin(a+Step) + Y; Line[Count].x = X1; Line[Count].y = Y1; Line[Count+1].x = X2; Line[Count+1].y = Y2; Count += 2; } pLine->Begin(); pLine->Draw(Line,Count,Color); pLine->End(); } // Drawing it:DrawCircle(CenterX,CenterY,8,8,Red);

Cross Crosshair:
NB: XPosStart YPosStart mulai garis dan kemudian XPO Finish Finish YPO adalah di mana garis akan digambar juga. uploads/monthly_07_2011/post-14872-058598300%201311070130_thumb.jpg

Code

Quote
//DrawCircle(XPosition,YPosition,Radius,numSides,Col or);Function:void DrawCircle(int X, int Y, int radius, int numSides, DWORD Color) { D3DXVECTOR2 Line[128]; float Step = PI * 2.0 / numSides; int Count = 0; for (float a=0; a < PI*2.0; a += Step) { float X1 = radius * cos(a) + X; float Y1 = radius * sin(a) + Y; float X2 = radius * cos(a+Step) + X; float Y2 = radius * sin(a+Step) + Y; Line[Count].x = X1; Line[Count].y = Y1; Line[Count+1].x = X2; Line[Count+1].y = Y2; Count += 2; } pLine->Begin(); pLine->Draw(Line,Count,Color); pLine->End(); } // Drawing it:DrawCircle(CenterX,CenterY,8,8,Red);

NB: Sekarang bahwa kita memiliki yang utama Anda bisa mulai menggabungkan mereka dan membuat yang Anda sendiri.
Anda memiliki semua fungsi jadi sakit hanya memberikan gambaran Anda dan kode gambar


uploads/monthly_07_2011/post-14872-082774100%201311070225_thumb.jpg

Code

Quote
DrawCircle(CenterX,CenterY,8,8,Red);//CircleFillRGB(CenterX-17, CenterY, 10, 1,Red,pDevice);//Left lineFillRGB(CenterX+9, CenterY, 10, 1,Red,pDevice); // Right lineFillRGB(CenterX, CenterY-17, 1, 10,Red,pDevice);//Top lineFillRGB(CenterX, CenterY+9, 1, 10,Red,pDevice);//Bottom lineDrawPoint(CenterX, CenterY, 1, 1, Green);//Dot point

uploads/monthly_07_2011/post-14872-070741700%201311070268_thumb.jpg

Code

Quote
FillRGB(CenterX-15, CenterY, 10, 1,Red,pDevice);//Left lineFillRGB(CenterX+6, CenterY, 10, 1,Red,pDevice);//Right lineFillRGB(CenterX, CenterY-15, 1, 10,Red,pDevice);//Top lineFillRGB(CenterX, CenterY+6, 1, 10,Red,pDevice);//Bottom lineDrawPoint(CenterX-1 , CenterY-1, 1, 1, Green);//Dot point

uploads/monthly_07_2011/post-14872-087569600%201311070315_thumb.jpg

Code


Quote
DrawCircle(CenterX-1,CenterY-1,8,8,Red);//CircleFillRGB(CenterX-13, CenterY, 10, 1,Red,pDevice);//Left lineFillRGB(CenterX+4, CenterY, 10, 1,Red,pDevice);//Right lineFillRGB(CenterX, CenterY-13, 1, 10,Red,pDevice);//Top lineFillRGB(CenterX, CenterY+4, 1, 10,Red,pDevice);//Bottom lineDrawPoint(CenterX-1 , CenterY-1, 1, 1, Green);//Dot point


uploads/monthly_07_2011/post-14872-038976100%201311070394_thumb.jpg

Code

Quote
DrawLine(CenterX+15,CenterY+15,CenterX+3,CenterY+3 ,2,Red);// Bottom right to centerDrawLine(CenterX-15,CenterY+15,CenterX-3,CenterY+3,2,Red);//Bottom left to centerDrawLine(CenterX+15,CenterY-15,CenterX+3,CenterY-3,2,Red);//Top right to centerDrawLine(CenterX-15,CenterY-15,CenterX-3,CenterY-3,2,Red);//Top left to centerDrawPoint(CenterX,CenterY,1,1,Green);//Dot point

nahh Nie Yg terkhir yg biasa di pake... kalian

uploads/monthly_07_2011/post-14872-064683700%201311070452_thumb.jpg

Code

Quote
FillRGB(CenterX-20, CenterY, 40, 1,Purple,pDevice);//PurpleFillRGB(CenterX, CenterY-20, 1, 40,Purple,pDevice); FillRGB(CenterX-17, CenterY, 34, 1,Blue,pDevice);//BlueFillRGB(CenterX, CenterY-17, 1, 34,Blue,pDevice); FillRGB(CenterX-14, CenterY, 28, 1,Cyan,pDevice);//CyanFillRGB(CenterX, CenterY-14, 1, 28,Cyan,pDevice); FillRGB(CenterX-11, CenterY, 22, 1,Green,pDevice);//GreenFillRGB(CenterX, CenterY-11, 1, 22,Green,pDevice); FillRGB(CenterX-9, CenterY, 18, 1,Yellow,pDevice);//YellowFillRGB(CenterX, CenterY-9, 1, 18,Yellow,pDevice); FillRGB(CenterX-6, CenterY, 12, 1,Orange,pDevice);//OrangeFillRGB(CenterX, CenterY-6, 1, 12,Orange,pDevice); FillRGB(CenterX-3, CenterY, 6, 1,Red,pDevice);//RedFillRGB(CenterX, CenterY-3, 1, 6,Red,pDevice);

Sekian Code D3D Crosshairs
By : DHiLaH@Masakazu C4

SumBer
/**********************************************************NaHH SEMOGA BERMANFAAT*****************************************************************/

0 Komentar:

Posting Komentar

Berlangganan Posting Komentar [Atom]

<< Beranda