#define
XFONT_TRUETYPE // <-- DON'T FORGET THIS OR ELSE
IT WON'T WORK!
#include
<xfont.h> //used for directX textout
......
// Now don't forget to put the "times.ttf" file or whatever ttf file your
// going to use for your font, with your xbox executable (xbe).
void
DisplayText()
{
//Create some DirectX text buffers
XFONT* pFont;
LPDIRECT3DSURFACE8 pFrontBuffer;
//InitialiseFonts
g_pD3DDevice->GetBackBuffer(-1,D3DBACKBUFFER_TYPE_MONO,&pFrontBuffer);
DWORD dwFontCacheSize = 16 * 1024;
XFONT_OpenTrueTypeFont(L"D:\\times.ttf", dwFontCacheSize, &pFont );
// pFont->SetTextHeight(48);
// pFont->SetTextColor(D3DCOLOR_XRGB(30,255,20));
WCHAR szbuff[200] = {0};
swprintf(szbuff, L"Hello World");
//Top left corner of where we want to draw our
text.
float xpos = 100.0f;
float ypos = 100.0f;
//Display our text.
pFont->SetTextColor(D3DCOLOR_XRGB(30,255,20));
pFont->TextOut(
pFrontBuffer,
szbuff, -1, (long)xpos, (long)ypos
);
//Release our TextBuffers
pFont->Release();
pFrontBuffer->Release();
}//
End DisplayText()
|