• Advertisement
Sign in to follow this  

Rotating Text

This topic is 2640 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hello,

How can i obtain the font sprite's dimensions I use to render D3DX fonts?

d3dxFontSprite->Begin(D3DXSPRITE_ALPHABLEND | D3DXSPRITE_SORT_TEXTURE);
d3dxFont->DrawText(d3dxFontSprite, str.c_str(), -1, &rct, 0, getD3DColor(color));
d3dxFontSprite->End();

My goal is to rotate the text about the sprite's center instead of the world origin.

Thanks.

Share this post


Link to post
Share on other sites
Advertisement
There is DT_CALCRECT flag, it'll fill your RECT structure with coordinates.

Share this post


Link to post
Share on other sites
How can I use the RECT structure after the draw call and text is already rendered?

What I want to do is to be able to rotate text around it's center instead of the origin (0, 0)

Thanks.

Share this post


Link to post
Share on other sites
You want:

RECT rct;
rct.left = rct.top = rct.right = rct.bottom = 0;
d3dxFont->DrawText(NULL, str.c_str(), -1, &rct, DT_CALCRECT, 0);

Share this post


Link to post
Share on other sites
Then it's too late to make use of the returned rc to figure out the correct transformation for the already drawn text ;)

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement