Directx 9 Çember Cizdirme

Durum
Üzgünüz bu konu cevaplar için kapatılmıştır...
Uzman Üye
Katılım
11 Ara 2016
Mesajlar
176
Tepki puanı
6
Yaş
29
9 HİZMET YILI
evet arkadaşlar çizdirdiğimiz çember aşagıdaki gibidir,cizgi halindedir çemberin boyutlarını kendimiz belirliyoruz


O0jDv3.png


////////////////FONKSİYON///////

Kod:
#define D3DFVF_TL (D3DFVF_XYZRHW | D3DFVF_DIFFUSE | D3DFVF_TEX1)
 struct D3DTLVERTEX
 {
     float fX;
     float fY;
     float fZ;
     float fRHW;
     D3DCOLOR Color;
     float fU;
     float fV;
 };

 //-----------------------------------------------------------------------------------
 //CreateD3DTLVERTEX--Populate a D3DTLVERTEX structure
 //-----------------------------------------------------------------------------------
 D3DTLVERTEX CreateD3DTLVERTEX(float X, float Y, float Z, float RHW,
     D3DCOLOR color, float U, float V)
 {
     D3DTLVERTEX v;

     v.fX = X;
     v.fY = Y;
     v.fZ = Z;
     v.fRHW = RHW;
     v.Color = color;
     v.fU = U;
     v.fV = V;

     return v;
 }//

 //-----------------------------------------------------------------------------------

 void Draw2DCircle(int x, int y, float radius, D3DCOLOR color, LPDIRECT3DDEVICE9 dev)

 {

     const int NUMPOINTS = 24;

     const float PI = 3.14159;



     D3DTLVERTEX Circle[NUMPOINTS + 1];

     int i;

     float X;

     float Y;

     float Theta;

     float WedgeAngle;    //Size of angle between two points on the circle (single wedge)



     //Precompute WedgeAngle

     WedgeAngle = (float)((2 * PI) / NUMPOINTS);



     //Set up vertices for a circle

     //Used <= in the for statement to ensure last point meets first point (closed circle)

     for (i = 0; i <= NUMPOINTS; i++)

     {

         //Calculate theta for this vertex

         Theta = i * WedgeAngle;



         //Compute X and Y locations

         X = (float)(x + radius * cos(Theta));

         Y = (float)(y - radius * sin(Theta));



         Circle[i] = CreateD3DTLVERTEX(X, Y, 0.0f, 1.0f, color, 0.0f, 0.0f);

     }

 //Now draw the circle

     dev->SetFVF(D3DFVF_TL);

     dev->SetTexture(0, NULL);

     dev->DrawPrimitiveUP(D3DPT_LINESTRIP, NUMPOINTS, &Circle[0], sizeof(Circle[0]));

 }//Draw2DCircle

//////////////////ÇİZDİRMEK İÇİN//////
Kod:
Draw2DCircle(150, 360, 71, D3DCOLOR_ARGB(255, 255, 0, 255), pDevice);///x konumu,Y konumu,Çemberin yarıçapı,renk, pDevice
 
Bilinmiyor
Efsane Üye
Katılım
26 Şub 2016
Mesajlar
4,271
Çözümler
3
Tepki puanı
792
Ödüller
13
10 HİZMET YILI
bunun yapımı basit :) sağolasın yinede
 
<Ç0rumlu>
Ultra Üye
Katılım
19 May 2016
Mesajlar
1,546
Tepki puanı
135
Ödüller
10
Yaş
29
10 HİZMET YILI
Bunun İçine bide X çizdircen efso olur.,Teşekkürler Paylaşım İçin
 
Durum
Üzgünüz bu konu cevaplar için kapatılmıştır...
Üst