Evet arkadaşlar çizdirdiğimiz çember aşagıdaki gibidir.,cizgi halindedir çemberin boyutlarını kendimiz belirliyoruz.
////////////////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 = 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
////////////////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 = 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
💬 SpyHackerz Telegram — Anlık tartışmalar ve duyurular için katıl