Font.cpp
资源名称:3DRPG.rar [点击查看]
上传用户:cjwanglu
上传日期:2013-07-10
资源大小:4744k
文件大小:1k
源码类别:
游戏
开发平台:
Visual C++
- #include "stdafx.h"
- #include "Font.h"
- CFont::CFont(LPDIRECT3DDEVICE9 d3dd,LPSTR pFontFace)
- {
- m_pD3DDevice=d3dd;
- D3DXCreateFont(m_pD3DDevice,0,0,FW_BOLD,0,1,ANSI_CHARSET,OUT_DEFAULT_PRECIS,DEFAULT_QUALITY,0,pFontFace,&m_pFont);
- D3DXCreateFont(m_pD3DDevice,0,0,FW_BOLD,0,1,ANSI_CHARSET,OUT_DEFAULT_PRECIS,DEFAULT_QUALITY,0,pFontFace,&m_pFont_1);
- }
- CFont::~CFont()
- {
- SafeRelease(m_pFont);
- }
- void CFont::DrawText(LPSTR pText,float x,float y)
- {
- RECT rect;
- rect.left=x;
- rect.top=y;
- rect.right=500;
- rect.bottom=100;
- m_pFont->DrawText(NULL,pText,-1,&rect,DT_CALCRECT,0);
- m_pFont->DrawText(NULL,pText,-1,&rect,DT_LEFT,D3DCOLOR_XRGB(255,255,255));
- }
- void CFont::DrawText_1(LPSTR pText,float x,float y)
- {
- RECT rect;
- rect.left=x;
- rect.top=y;
- rect.right=500;
- rect.bottom=100;
- m_pFont->DrawText(NULL,pText,-1,&rect,DT_CALCRECT,0);
- m_pFont->DrawText(NULL,pText,-1,&rect,DT_LEFT,D3DCOLOR_XRGB(255,255,255));
- }