[SOLVED] Sprites with text

Recommended Posts

The problem is, I am trying to draw text onto a square that I am drawing using d3d->DrawPrimitive(D3DPT_TRIANGLESTRIP, 0, 2); For some reason, DrawPrimitive refuses to show my textured square unless I enclose it with Sprite->Begin(flags) and Sprite->End(). If I comment out the DrawPrimitive statement, there is no text there. If I enclose my DrawText() function with the Sprite->Begin and End statements then the text displays. For some reason, if I start this whole function off with Sprite->Begin and end it with Sprite->End my text won't show up but my textured square will. So how do I get my text to show up on top of the square?
int SD_MENU::Render()
{
d2d->Begin();
d3d->SetTransform(D3DTS_VIEW, &cam->GetView());
d3d->SetTransform(D3DTS_PROJECTION, &cam->GetProjection());
if (FAILED(d3d->DrawPrimitive(D3DPT_TRIANGLESTRIP, 0, 2)))
{
return 0;
}
d3d->SetTexture(0, NULL);
d3d->SetFVF(NULL);

RECT options_rect = { 55, -150, 425, 550 };
font->DrawTextA(d2d->GetSprite(), (char*)menu_options[i], (INT)strlen((char*)menu_options[i]), &options_rect, DT_LEFT | DT_VCENTER | DT_NOCLIP, D3DCOLOR_RGBA(255, 255, 255, 255));
options_rect.top = options_rect.top + 60;
}
d2d->End();

return 1;
}


[Edited by - orphankill on October 9, 2007 10:44:42 AM]

Share on other sites
Sorry for wasting your time, solved it myself (as I usually do if I play with it long enough). I had to make 2 calls to sprite->begin and to sprite->end, back to back surrounding the text and texture. Don't know why but it works.

Create an account

Register a new account

• Forum Statistics

• Total Topics
627697
• Total Posts
2978680

• 20
• 14
• 12
• 10
• 12