티스토리 뷰

class cText2
{
 LPD3DXMESH m_mesh;


public:
 cText2();
 ~cText2();

 void Setup();

 void Draw();

};

cText2::cText2()
{
}


cText2::~cText2()
{

//사용후엔 해제 필수!
 SAFE_RELEASE(m_mesh);
}


void cText2::Setup()
{
 HDC hdc=GetDC(g_hWnd);
 //HDC에서 글꼴을 설정하고
 //HFONT font, oldFont;

 LOGFONT font;
 ZeroMemory(&font, sizeof(LOGFONT));

 font.lfHeight = 100.f;
 font.lfWidth = 30.f;

 HFONT hFont;
 HFONT hOldFont;

 hFont = CreateFontIndirect(&font);
 hOldFont = (HFONT)SelectObject(hdc, hFont);

 D3DXCreateText(g_pD3DDevice,hdc,TEXT("hi") ,0.001f,0.4f, &m_mesh, NULL,0);

 DeleteObject(SelectObject(hdc, hOldFont));
 ReleaseDC(g_hWnd,hdc);
}

void cText2::Draw()
{
 m_mesh->DrawSubset(0);

}

댓글