Skip to main content
gamedev.net
🔒 Locked

Font problems

Started by TheMac Dec 22, 2004 at 2:35 PM 1 replies 350+ views
Original Post
TheMac
TheMac
I am having trouble using fonts in my very simple program. If anyone could help you would make my day. This defines it in one class: ID3DXFont* g_Font; Defines the initalize function in a namespace, not in another class: int FontInit(LPDIRECT3DDEVICE9 Device, ID3DXFont** g_Font); Heres the init function: int D3D::FontInit(LPDIRECT3DDEVICE9 m_Device, ID3DXFont** m_Font) { HRESULT hr; D3DXFONT_DESC fd; memset(&fd, '0', sizeof(D3DXFONT_DESC)); fd.Height = 25; fd.Width = 12; fd.Weight = 500; fd.Italic = false; fd.CharSet = DEFAULT_CHARSET; fd.Quality = 0; fd.PitchAndFamily = 0; strcpy(fd.FaceName, "Times New Roman"); // Default font hr = D3DXCreateFontIndirect(m_Device, &fd, m_Font); if(FAILED(hr)) { MessageBox(0, "D3DXCreateFontIndirect() - FAILED", 0, 0); return -1; } return 0; } Now calling it everytime I render: int i = g_Font->DrawText(NULL, "12345678", 8, ▭, DT_NOCLIP, 0x00000000); When I ckeck 'i', i = 25, which is the size of the font. I checked the background color and is white. Changed a bunch of stuff, still can not get it to work. I don't get any errors with it either. PLEASE HELP Thanks.
sirob
sirob
0x00000000 has an alpha of 0, which is transparent. Try 0xFF000000 for black colored text (FF is 255 -- which is the maximum opacity).
Sirob Yes.» - status: Work-O-Rama.
TheMac
TheMac
Quote:
Original post by sirob
0x00000000 has an alpha of 0, which is transparent. Try 0xFF000000 for black colored text (FF is 255 -- which is the maximum opacity).


Oh man thank you so much, it worked fine. You rock sirob!

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.