• Advertisement

Archived

This topic is now archived and is closed to further replies.

Font +Direct3d

This topic is 5561 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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 ??

Share this post


Link to post
Share on other sites
Advertisement

        	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]

Share this post


Link to post
Share on other sites
thx but i need an 3d font how can i handle this ?
i cant use the CD3DFont class

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites
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 ??

Share this post


Link to post
Share on other sites

  • Advertisement