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


Problems with CD3DFont...

Recommended Posts

I am trying to make a simple FPS counter in my program. I don''t really have the time to write my own bitmap font engine, so I figured I would use ID3DXFont, which was working. I looked at Drunken Hyena''s web site ( and he has a tutorial on something called CD3DFont. I have been looking through his code. Whenever I try to compile my program that tries to use CD3DFont, it gives me the following errors:
error C2252: ''g_font'' : pure specifier can only be specified for functions
error C2065: ''g_font'' : undeclared identifier
I can''t figure out what the heck I am doing wrong. Can anyone help me? I can post my source if necessary. Moe''s Site

Share this post

Link to post
Share on other sites
Ok, I messed around with it a bit more, and now I am getting some different error messages:
unresolved external symbol "public: long __thiscall CD3DFont::RestoreDeviceObjects(void)" (?RestoreDeviceObjects@CD3DFont@@QAEJXZ)
unresolved external symbol "public: long __thiscall CD3DFont::InitDeviceObjects(struct IDirect3DDevice8 *)" (?InitDeviceObjects@CD3DFont@@QAEJPAUIDirect3DDevice8@@@Z)
unresolved external symbol "public: __thiscall CD3DFont::CD3DFont(char *,unsigned long,unsigned long)" (??0CD3DFont@@QAE@PADKK@Z)
//and so on...

Here is how I am trying to use CD3DFont...
Headers and initialization:
#include "d3dfont.h"

//further into the program

//the font thing

CD3DFont *g_font;

//inside my initialization function for d3d...

g_font=new CD3DFont("Arial", //The name of the font we want to load

26, //The size of the font

D3DFONT_BOLD); //Flags supported are:D3DFONT_ITALIC and D3DFONT_BOLD

//This set us SOME of the required objects


My rendering...
char buffer[20];
float fps=0.0f;

fps = 1.0f/timer.Delta;


d3d.g_font->DrawText(0, //X position in screen coordinates

0, //Y position in screen coordinates

0xFFBBBBBB, //Colour

buffer); //String to be rendered

The shutdown code...
//Not much to do here, just delete the object..

delete g_font;

Moe''s Site

Share this post

Link to post
Share on other sites