使用這個(gè)函數(shù)時(shí),需要一個(gè)D3DXFONT_DESC結(jié)構(gòu):
D3DXFONT_DESC d3dFont;
memset(&d3dFont,0,sizeof(d3dFont));
d3dFont.Height=25; // in logical units
d3dFont.Width=12;? // in logical units
d3dFont.Weight=500;// boldness, range 0(light) - 1000(bold)
d3dFont.Italic=FALSE;
d3dFont.CharSet=DEFAULT_CHARSET;
strcpy(d3dFont.FaceName,"Times New Roman");
ID3DXFont* font=0;
D3DXCreateFontIndirect(Device,&d3dFont,&font);
如果你使用的是LOGFONT結(jié)構(gòu),則:
LOGFONT lf;
ZeroMemory(&lf, sizeof(LOGFONT));
lf.lfHeight = 25; // in logical units
lf.lfWidth = 12; // in logical units
lf.lfWeight = 500; // boldness, range 0(light) - 1000(bold)
lf.lfItalic = false;
lf.lfUnderline = false;
lf.lfStrikeOut = false;
lf.lfCharSet = DEFAULT_CHARSET;
strcpy(lf.lfFaceName, "Times New Roman"); // font style
ID3DXFont* font = 0;
D3DXCreateFontIndirect(Device, &lf, &font);
另外,還可以使用D3DXCreateFont函數(shù)創(chuàng)建ID3DXFont的對(duì)象。
from:http://we2002king.spaces.live.com/blog/
posted on 2007-02-27 11:21
我風(fēng) 閱讀(2264)
評(píng)論(0) 編輯 收藏 引用