0001:
0002:
0003:
0004:
0005:
0006: #ifndef D3DFONT_H
0007: #define D3DFONT_H
0008: #include <tchar.h>
0009: #include <D3D8.h>
0010:
0011:
0012:
0013: #define D3DFONT_BOLD 0x0001
0014: #define D3DFONT_ITALIC 0x0002
0015: #define D3DFONT_ZENABLE 0x0004
0016:
0017:
0018: #define D3DFONT_CENTERED 0x0001
0019: #define D3DFONT_TWOSIDED 0x0002
0020: #define D3DFONT_FILTERED 0x0004
0021:
0022:
0023:
0024:
0025:
0026:
0027:
0028:
0029: class CD3DFont
0030: {
0031: TCHAR m_strFontName[80];
0032: DWORD m_dwFontHeight;
0033: DWORD m_dwFontFlags;
0034:
0035: LPDIRECT3DDEVICE8 m_pd3dDevice;
0036: LPDIRECT3DTEXTURE8 m_pTexture;
0037: LPDIRECT3DVERTEXBUFFER8 m_pVB;
0038: DWORD m_dwTexWidth;
0039: DWORD m_dwTexHeight;
0040: FLOAT m_fTextScale;
0041: FLOAT m_fTexCoords[128-32][4];
0042:
0043:
0044: DWORD m_dwSavedStateBlock;
0045: DWORD m_dwDrawTextStateBlock;
0046:
0047: public:
0048:
0049: HRESULT DrawText( FLOAT x, FLOAT y, DWORD dwColor,
0050: TCHAR* strText, DWORD dwFlags=0L );
0051: HRESULT DrawTextScaled( FLOAT x, FLOAT y, FLOAT z,
0052: FLOAT fXScale, FLOAT fYScale, DWORD dwColor,
0053: TCHAR* strText, DWORD dwFlags=0L );
0054: HRESULT Render3DText( TCHAR* strText, DWORD dwFlags=0L );
0055:
0056:
0057: HRESULT GetTextExtent( TCHAR* strText, SIZE* pSize );
0058:
0059:
0060: HRESULT InitDeviceObjects( LPDIRECT3DDEVICE8 pd3dDevice );
0061: HRESULT RestoreDeviceObjects();
0062: HRESULT InvalidateDeviceObjects();
0063: HRESULT DeleteDeviceObjects();
0064:
0065:
0066: CD3DFont( TCHAR* strFontName, DWORD dwHeight, DWORD dwFlags=0L );
0067: ~CD3DFont();
0068: };
0069:
0070:
0071:
0072:
0073: #endif
0074:
0075:
0076: