Font.cpp
上传用户:cjwanglu
上传日期:2013-07-10
资源大小:4744k
文件大小:1k
源码类别:

游戏

开发平台:

Visual C++

  1. #include "stdafx.h"
  2. #include "Font.h"
  3. CFont::CFont(LPDIRECT3DDEVICE9 d3dd,LPSTR pFontFace)
  4. {
  5. m_pD3DDevice=d3dd;
  6. D3DXCreateFont(m_pD3DDevice,0,0,FW_BOLD,0,1,ANSI_CHARSET,OUT_DEFAULT_PRECIS,DEFAULT_QUALITY,0,pFontFace,&m_pFont);
  7.     D3DXCreateFont(m_pD3DDevice,0,0,FW_BOLD,0,1,ANSI_CHARSET,OUT_DEFAULT_PRECIS,DEFAULT_QUALITY,0,pFontFace,&m_pFont_1);
  8. }
  9. CFont::~CFont()
  10. {
  11. SafeRelease(m_pFont);
  12. }
  13. void CFont::DrawText(LPSTR pText,float x,float y)
  14. {
  15. RECT rect;
  16. rect.left=x;
  17. rect.top=y;
  18. rect.right=500;
  19. rect.bottom=100;
  20. m_pFont->DrawText(NULL,pText,-1,&rect,DT_CALCRECT,0);
  21. m_pFont->DrawText(NULL,pText,-1,&rect,DT_LEFT,D3DCOLOR_XRGB(255,255,255));
  22. }
  23. void CFont::DrawText_1(LPSTR pText,float x,float y)
  24. {
  25.     RECT rect;
  26. rect.left=x;
  27. rect.top=y;
  28. rect.right=500;
  29. rect.bottom=100;
  30. m_pFont->DrawText(NULL,pText,-1,&rect,DT_CALCRECT,0);
  31. m_pFont->DrawText(NULL,pText,-1,&rect,DT_LEFT,D3DCOLOR_XRGB(255,255,255));
  32. }