12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091 |
- #ifndef GEISS_TEXT_DRAWING_MANAGER
- #define GEISS_TEXT_DRAWING_MANAGER 1
- #ifdef _DEBUG
- #define D3D_DEBUG_INFO
- #endif
- #include <d3d9.h>
- #include <d3dx9.h>
- #include "md_defines.h"
- #include "..\nu\AutoWide.h"
- #define MAX_MSGS 4096
- typedef struct
- {
- wchar_t* msg;
- LPD3DXFONT pfont;
- RECT rect;
- DWORD flags;
- DWORD color;
- DWORD bgColor;
- int added, deleted;
- void* prev_dark_box_ptr;
- }
- td_string;
- class CTextManager
- {
- public:
- CTextManager();
- ~CTextManager();
-
- void Init(LPDIRECT3DDEVICE9 lpDevice, IDirect3DTexture9* lpTextSurface, int bAdditive);
- void Finish();
-
- int DrawText(LPD3DXFONT pFont, char* szText, RECT* pRect, DWORD flags, DWORD color, bool bBlackBox, DWORD boxColor=0xFF000000);
- int DrawText(LPD3DXFONT pFont, char* szText, int len, RECT* pRect, DWORD flags, DWORD color, bool bBox, DWORD boxColor=0xFF000000) {
- return DrawTextW(pFont, AutoWide(szText), pRect, flags, color, bBox, boxColor);
- };
- int DrawTextW(LPD3DXFONT pFont, wchar_t* szText, RECT* pRect, DWORD flags, DWORD color, bool bBlackBox, DWORD boxColor=0xFF000000);
- int DrawTextW(LPD3DXFONT pFont, wchar_t* szText, int len, RECT* pRect, DWORD flags, DWORD color, bool bBox, DWORD boxColor=0xFF000000) {
- return DrawTextW(pFont, szText, pRect, flags, color, bBox, boxColor);
- };
- void DrawBox(LPRECT pRect, DWORD boxColor);
- void DrawDarkBox(LPRECT pRect) { DrawBox(pRect, 0xFF000000); }
- void DrawNow();
- void ClearAll();
- protected:
- LPDIRECT3DDEVICE9 m_lpDevice;
- IDirect3DTexture9* m_lpTextSurface;
- int m_blit_additively;
- int m_nMsg[2];
- td_string m_msg[2][MAX_MSGS];
- wchar_t* m_next_msg_start_ptr;
- int m_b;
- };
- #endif
|