Font +Direct3d
How can i use fonts in direct3d ??
i read the sample code from the sdk8
but i my programm i cant use the "d3dfont.h"
because of many undeclariations ...
anybody knows a good sample code .... tutorial for this
problem ??
LOGFONT log_font={ 24, //height 0, //width; 0, // lfEscapement; 0, //lfOrientation; FW_BOLD, // lfWeight; FALSE, // lfItalic; FALSE, // lfUnderline; FALSE, // lfStrikeOut; DEFAULT_CHARSET, // lfCharSet; OUT_DEFAULT_PRECIS, //lfOutPrecision; CLIP_DEFAULT_PRECIS, // lfClipPrecision; ANTIALIASED_QUALITY,// lfQuality; DEFAULT_PITCH,// lfPitchAndFamily; "Times New Roman"// lfFaceName[LF_FACESIZE]; }; //This is all there is to creating a D3DXFont. Pretty easy, eh? hr = D3DXCreateFontIndirect( engine->GetDevice() , &log_font , &m_Font);
this will create the font itself....
this->m_Font->Begin(); RECT font_rect={ 0, 0, 9999, 9999}; font_rect.top = y; font_rect.left = x; this->m_Font->DrawTextA( "text" , -1 , &font_rect , 0 , this->m_Color ); this->m_Font->End();
this will draw text!
.lick
[edited by - Pipo DeClown on December 5, 2002 5:58:41 AM]
Why can''t you use CD3DFont class ???
what kind of "undeclariations" do you have ???
maybe you should include some more files in your
project like "dxutil.cpp" and "d3dutil.cpp" and
it''s include files...
Kamikaze
what kind of "undeclariations" do you have ???
maybe you should include some more files in your
project like "dxutil.cpp" and "d3dutil.cpp" and
it''s include files...
Kamikaze
to use this->m_Font->Begin(); ....
i need to declare m_Font like this
CD3DFont* m_pFont;
but CD3DFont is not declaired
i can include "d3dfont.h" only before
#include "stdafx.h" otherwise something like LPBLaBLA
is not declaired too
these are my include files for the font:
#include <d3d8.h>
#include <d3dx8.h>
#include <d3dfont.h>
#include "stdafx.h"
#include <ddraw.h>
#include <d3d.h>
#include <d3drmwin.h>
did i forgot anything ??
i need to declare m_Font like this
CD3DFont* m_pFont;
but CD3DFont is not declaired
i can include "d3dfont.h" only before
#include "stdafx.h" otherwise something like LPBLaBLA
is not declaired too
these are my include files for the font:
#include <d3d8.h>
#include <d3dx8.h>
#include <d3dfont.h>
#include "stdafx.h"
#include <ddraw.h>
#include <d3d.h>
#include <d3drmwin.h>
did i forgot anything ??
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement