Guest User

Untitled

a guest
Oct 22nd, 2017
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.78 KB | None | 0 0
  1. void Impire::Circle(int x, int y, float radius, D3DCOLOR color, IDirect3DDevice9* pDevice)
  2. {
  3. const DWORD D3D_FVF = D3DFVF_XYZRHW | D3DFVF_DIFFUSE | D3DFVF_TEX1;
  4. const int NUMPOINTS = 24;
  5. const float PI = ( float )3.141592654f;
  6. LineVertex Circle[NUMPOINTS + 1];
  7. float X, Y, Theta, WedgeAngle;
  8. WedgeAngle = (float)((2*PI) / NUMPOINTS);
  9.  
  10. for(int i=0; i<=NUMPOINTS; i++)
  11. {
  12. Theta = i * WedgeAngle;
  13. X = (float)(x + radius * cos(Theta));
  14. Y = (float)(y - radius * sin(Theta));
  15. Circle[i] = CreateD3DTLVERTEX(X, Y, 0.0f, 1.0f, color, 0.0f, 0.0f);
  16. }
  17. pDevice->SetFVF(D3D_FVF);
  18. pDevice->SetTexture(0, NULL);
  19. pDevice->DrawPrimitiveUP(D3DPT_LINESTRIP, NUMPOINTS, &Circle[0], sizeof(Circle[0]));
  20. }
Add Comment
Please, Sign In to add comment