FPS를 출력하기 위해서는 우선 D3D에서 제공하는 폰트 클래스부터 이용하여 문자를 출력한 후에 설명하겠다..
1. View 클래스에 멤버 변수로 Font Desc 구조체와 실제 등록할 폰트 변수를 선언한다.
2. 폰트 초기화 함수 등록 후 OnInitialize 함수에서 초기화한다.
실제 위 함수에서는 폰트파일이 Font 폴더에 없을경우 함께 배포하게 될때 사용되는 AddFontResource도 넣어뒀다.
3. 종료시 FontResource 의 해제
4. 실제 폰트의 Draw 부분
1. View 클래스에 멤버 변수로 Font Desc 구조체와 실제 등록할 폰트 변수를 선언한다.
CView.cppView 클래스에 멤버변수 선언
public: //D3DXFont 관련 변수 LPD3DXSPRITE m_pSprite; LPD3DXFONT m_pFont; // 실제 폰트 객체 포인터 ( 생성자에서 NULL 초기화 잊지말자 ) D3DXFONT_DESC desc; // D3DFont 를 사용하기 위한. 설정 LPD3DXFONT m_pFont_Eng8; LPD3DXFONT m_pFont_Eng12; LPD3DXFONT m_pFont_Kor8; LPD3DXFONT m_pFont_Kor12;
2. 폰트 초기화 함수 등록 후 OnInitialize 함수에서 초기화한다.
CView.cppView 클래스에 함수 등록 하여 사용
// 폰트 초기화 함수
void CEx1View::D3DFontInit(void)
{
this->desc.CharSet = DEFAULT_CHARSET;
_tcscpy_s(desc.FaceName, _countof(desc.FaceName), _T("tahoma"));
this->desc.Weight = 500;
this->desc.Quality = DEFAULT_QUALITY;
this->desc.MipLevels = D3DX_DEFAULT;
this->desc.Italic = 0;
this->desc.OutputPrecision = OUT_DEFAULT_PRECIS;
this->desc.PitchAndFamily = FF_DONTCARE;
this->desc.Width = 8;
this->desc.Height = desc.Width + (int)(desc.Width/2);
D3DXCreateFontIndirect(this->m_pd3dDevice,&this->desc,&this->m_pFont_Eng8);
this->desc.Width = 12;
this->desc.Height = desc.Width + (int)(desc.Width/2);
D3DXCreateFontIndirect(this->m_pd3dDevice,&this->desc,&this->m_pFont_Eng12);
this->desc.CharSet = HANGEUL_CHARSET;
_tcscpy_s(desc.FaceName, _countof(desc.FaceName), _T("한글폰트네임"));
this->desc.Width = 8;
this->desc.Height = desc.Width + (int)(desc.Width/2);
D3DXCreateFontIndirect(this->m_pd3dDevice,&this->desc,&this->m_pFont_Kor8);
this->desc.Width = 12;
this->desc.Height = desc.Width + (int)(desc.Width/2);
D3DXCreateFontIndirect(this->m_pd3dDevice,&this->desc,&this->m_pFont_Kor12);
//폰트 리소스의 등록
//1. 현재경로구하기
TCHAR szModulePath[255*4];
ZeroMemory(szModulePath, sizeof(szModulePath));
::GetModuleFileName(NULL, szModulePath, sizeof(szModulePath));
// 2. Get Path
CString strPath = szModulePath;
int nPos = strPath.ReverseFind(_T('\\'));
strPath = strPath.Left(nPos+1);
//폰트등록
CString tmp = strPath + _T("한글폰트네임.ttf");
AddFontResource(tmp);
}
void CEx1View::OnInitialUpdate()
{
//Sprite 의 생성
D3DXCreateSprite(this->m_pd3dDevice, &this->m_pSprite); // DX_9.0c ,이상에서는 폰트는 Sprite를 통해서 출력해야함
//D3DXFont 클래스의 초기화
this->D3DFontInit();
}
실제 위 함수에서는 폰트파일이 Font 폴더에 없을경우 함께 배포하게 될때 사용되는 AddFontResource도 넣어뒀다.
3. 종료시 FontResource 의 해제
CView.cppCleanUp() 에 넣어서 함께 처리
//폰트 리소스의 해제
//1. 현재경로구하기
TCHAR szModulePath[255*4];
ZeroMemory(szModulePath, sizeof(szModulePath));
::GetModuleFileName(NULL, szModulePath, sizeof(szModulePath));
// 2. Get Path
CString strPath = szModulePath;
int nPos = strPath.ReverseFind(_T('\\'));
strPath = strPath.Left(nPos+1);
//폰트해제
CString tmp = strPath + _T("한글폰트네임.ttf");
RemoveFontResource(tmp);4. 실제 폰트의 Draw 부분
CXXXView.cppDrawFont
//폰트관련
#define ENG8 0
#define ENG12 1
#define KOR8 2
#define KOR12 3
// 폰트출력
void CEx1View::DrawFont(const CString& str,int SelectFont, int DestX, int DestY, int Width, int Height,UINT format, D3DCOLOR Color)
{
RECT rect;
SetRect(&rect,DestX,DestY,DestX+Width,DestY+Height);
switch(SelectFont)
{
case ENG8:
this->m_pFont = this->m_pFont_Eng8;
break;
case ENG12:
this->m_pFont = this->m_pFont_Eng12;
break;
case KOR8:
this->m_pFont = this->m_pFont_Kor8;
break;
case KOR12:
this->m_pFont = this->m_pFont_Kor12;
break;
}
this->m_pFont->DrawText(this->m_pSprite,LPCTSTR(str),-1,&rect,format,Color);
}
내가 듣고싶은 음악
내가 들려주고싶은 음악
2012.01.09 12:01:30 (*.58.137.26)
It amazed me that I just find your pictures with new style. Christian louboutin canada popular in Canada. The beautiful christian louboutin 2012 can let the woman more graceful and more attractive. While in beautiful colorful summer, to show sex appeal and graceful, follow christian louboutin ankle Boots is undoubtedly a woman the most advantageous sexy weapons. Once you see the christian louboutin bags you will love it. The fashion and unique design let you be outstanding in the crowds. Trendy styles are waiting for you now. In aesthetic, christian louboutin evening of contained content are more profound and rich. Christian luboutin flats in women mind became a perfect metaphor. Christian louboutin pumps for fashion design, because it is very important when you decide to buy a christian louboutin sandals. Inexpensive method is well-known christian louboutin slingback, a variety of materials and exquisite design. It is the best choice for you to choose. If you put on it, you will enjoy a fashion style. It is fast delivery and free shipping. Christian louboutin sneakers Sale hot online now. -ZHY
2012.01.10 16:10:50 (*.138.17.158)
Ccx
Thanks your share this useless information, at the same time, I also have some good news to share.2012 is coming, put on Christian Louboutin 2011, throw 2010 annoyed,Christian Louboutin Ankle Boots at the end of the happy noisy party! Want to become focus in the party, sunbathes dress is cannot llack.Christian Louboutin Bags But ladies and how can lack a pair of beautiful Christian Louboutin Evening as dress collocation? A lot of people like to wear boots, someone who likes to tall boot, someone like short boots, but a pair of Christian Louboutin Flats with dye-in-the-wood individual character is that they must fight thing.Christian Louboutin High Boots Tall, charming,Christian Louboutin Pumps and show thin, even in winter also can wear a pretty and beautiful dress up.Christian Louboutin Ankle Boots, besides have everybody again, long to familiar calf halfway style,Christian Louboutin Sandals there are actually very short boots canister to challenge the novel style, almost only encase foot and ankle, only coated to even out of style, to extend women for primary task, leg line,Christian Louboutin Slingback and the october-december quarter because of unprecedented popular skinny pants),Christian Louboutin Sneakers very skinny with long gaiters trousers together seamlessly, fashionable tide women not to be missed.
2012.01.12 16:55:07 (*.193.89.133)
namely oxygen Kobe Bryant Shoes
the JORDAN sequence essential section: regardless within of inside the
simple fact that NIKE oxygen JORDAN I– this sort of athletic shoes at
that time experienced been acquiring Kobe Shoes unusual matching colours also toward the novel science and technology, but everyone not the instant cheap Kobe Shoes
believed that this may properly possibly be regarded like a myth start
unexpectedly. the twenty yr has passed, oxygen the JORDAN sequence
basketball shoe just like presently grew to acquire Adidas Crazy 8 Shoes
the near to for that earth most extraordinary basketball shoe sequence
now.In these twenty yr Spring and Autumn Period, oxygen Jordan twenty kobe v shoes
Jordan experienced two instances has resurfaced with three retirements;
In these twenty yr Spring and Autumn Period, oxygen the JORDAN sequence
has also kobe v sale
experienced the innumerable winds and rains. for can give oxygen on
this particular many very several many years the JORDAN sequence to
produce only a tiny summary, NIKE kobe 4 sneakers has promoted oxygen especially in 2005 the JORDAN sequence basketball shoe 20th section: oxygen JORDAN XX.
2012.01.20 15:12:47 (*.165.187.226)
Der FC Barcelona fc barcelona trikot hat nach dem Trikot Deutschland erkämpften 0-1 Auswärtssieg über den FC Valencia nicht nur einen wichtigen Schritt in werder bremen trikot Richtung Titelverteidigung gemacht (Mestalla galt vorab als eine der kompliziertesten noch ausstehenden Aufgaben) und trikot real madrid
authentic nfl jerseys
they can be used on as wellcoach bags on sale
may most likely needcoach outletonline
bags might as well buycoach outlet online
Many people can likecoach bags outlet
porary fashionablecoach bags outlet
together with lifestylecoach outlet store
well known greatwholesale designer bags
comfortable with itcheap coach
very coolwholesale nfl jerseys
We love to buyauthentic jerseys
Look beautiful bag charm