Decysen 0 Newbie Poster

Hi guys, i have this D3D code here:

void drawArrow(float x, float y, float yaw, D3DCOLOR color)
{
 D3DXVECTOR2 points[3];
 points[0] = D3DXVECTOR2(-3, 5);
 points[1] = D3DXVECTOR2( 0, 0);
 points[2] = D3DXVECTOR2( 3, 5);
 
 D3DXVECTOR2 points2[3];
 
 float rad_dir = D3DXToRadian(-yaw);
 
 for (int i=0; i<3; i++)
 {
  points2[i].x = ((points[i].x * cos( rad_dir )) - (points[i].y * sin( rad_dir ))) + x;
  points2[i].y = ((points[i].y * cos( rad_dir )) + (points[i].x * sin( rad_dir ))) + y; 
 }
 gLines->Draw(points2, 3, color);
}

Which would draw an arrow based on a players view direction. Now i have my own function (non D3D) :

void CDraw::DrawStringWithAngle( float x, float y, void* pFont, float* pColor, const char* pText ,float Angle )
{
    char buf[300] = {'\0'};
    va_list va_alist;

    va_start(va_alist, pText);
    vsprintf(buf, pText, va_alist);
    va_end(va_alist);

    DrawStringEngine( x, y, pFont, buf, pColor, 1.0f, 1.0f, Angle, 0.0f );
}

It draws an string with angle. The problem is, how can this be used? All that needs to be replaced is the "gLines->Draw" i think but i'm not sure how to make this work with my own function. I want to draw a single text with "^", but with angle with the function. The first D3DXVECTOR2 is normally the "^" and the second D3DXVECTOR2, is the one rotated. Any help is greatly appreciated.

Thanks,
Decysen.

P.S. The draw arrow function normally results in a "^" being drawn with an Angle, just now i want to do it with the Engine function.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.