Jump to content
  • Advertisement


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


Font +Direct3d

This topic is 5795 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

        	LOGFONT log_font={
24, //height

0, //width;

0, // lfEscapement;

0, //lfOrientation;

FW_BOLD, // lfWeight;

FALSE, // lfItalic;

FALSE, // lfUnderline;

FALSE, // lfStrikeOut;


OUT_DEFAULT_PRECIS, //lfOutPrecision;

CLIP_DEFAULT_PRECIS, // lfClipPrecision;


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


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 will draw text!


[edited by - Pipo DeClown on December 5, 2002 5:58:41 AM]

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


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

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!