From c2a2445897af17adb56a32dcf111312763a575d4 Mon Sep 17 00:00:00 2001 From: Toni Uhlig Date: Mon, 2 Jul 2018 01:06:39 +0200 Subject: initial commit Signed-off-by: Toni Uhlig --- csgo_wh/src/D9DW_Text.cpp | 44 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100755 csgo_wh/src/D9DW_Text.cpp (limited to 'csgo_wh/src/D9DW_Text.cpp') diff --git a/csgo_wh/src/D9DW_Text.cpp b/csgo_wh/src/D9DW_Text.cpp new file mode 100755 index 0000000..9b2e833 --- /dev/null +++ b/csgo_wh/src/D9DW_Text.cpp @@ -0,0 +1,44 @@ +#include "DLLMain.h" + +#include +#include +#include + +#include "D9DW_Text.h" + +bool D9DW_Text::bInit = false; +ID3DXFont* D9DW_Text::m_pFont = NULL; + + +void D9DW_Text::Create(IDirect3DDevice9* pDev) +{ + if (!bInit) + { + D3DXCreateFont(pDev, 15, 0, FW_BOLD, 0, FALSE, DEFAULT_CHARSET, OUT_TT_ONLY_PRECIS, DEFAULT_QUALITY, DEFAULT_PITCH | FF_DONTCARE, "Arial", &m_pFont); + bInit = true; + } +} + +void D9DW_Text::Release(void) +{ + if (bInit) + { + bInit = false; + m_pFont->Release(); + m_pFont = NULL; + } +} + +void D9DW_Text::DrawText(int x, int y, UINT32 rgb_alpha, const char *s_text, va_list p_va) +{ + if (!bInit) return; + RECT rct; + rct.left=x; + rct.top=y; + rct.right=rct.left+350; + rct.bottom=rct.top+350; + char logbuf[100] = {0}; + memset(&logbuf[0], '\0', 100); + _vsnprintf(logbuf, sizeof(logbuf), s_text, p_va); + m_pFont->DrawTextA(NULL, logbuf, sizeof(logbuf), &rct, 0, rgb_alpha); +} -- cgit v1.2.3