• Advertisement
  • entries
  • comments
  • views

Font Engine Demo

Sign in to follow this  


I'm still working on my 2D demo (I can't geting fringing/transitions to work). Hopefully I can have a demo for that later. Until then, I have this little font engine demo for you:QftDF

This was done pretty easily, here's the code that I used:

void Idle()
dftgfx::Direct3D::GetSingleton()->GetDeviceComPtr()->Clear(0, 0, D3DCLEAR_TARGET, 0xff000000, 1.0f, 0);

static int nTalkingIndex = 0;
static int nMsgIndex = 0;
static float fTalkingTime = 0.0f;
static float fMsgTime = 0.0f;
static bool bDone = false;
fTalkingTime += g_Timer.GetTimeElapsed();
fMsgTime += g_Timer.GetTimeElapsed();
std::string Talking = "Talking...";
std::string Message = "This is a complete message that will be\nrendered one character at a time!";

if(fTalkingTime > 0.5f)
if(nTalkingIndex > 3)
nTalkingIndex = 0;
fTalkingTime = 0.0f;

if(fMsgTime > 0.125f)
if(nMsgIndex >= Message.length())
bDone = true;
fMsgTime = 0.0f;

Talking = "Finished talking!!!";

dftgfx::FontEngine::GetSingleton()->GetItem(DEF_FONT)->DrawText(Message.c_str(), nMsgIndex, 0.0f, 0.0f, 0xffffffff);
dftgfx::FontEngine::GetSingleton()->GetItem(DEF_FONT)->DrawText(Talking.c_str(), bDone ? Talking.length() : Talking.length() + (nTalkingIndex - 3), 800.0f - (Talking.length() * 11), 600.0f - 24.0f, 0xffffffff);

dftgfx::Direct3D::GetSingleton()->GetDeviceComPtr()->Present(0, 0, 0, 0);

Sign in to follow this  


Recommended Comments

Is it still a bad idea to post the dll? If so you can copy and paste the one you have into the file where you downloaded the demo, and rename it to d3dx9_25.dll (not the greatest idea, but it does work). If its ok, then I can upload it.

Note: Also, if anybody downloaded it and it opened and closed, I had forgot to remove my depth buffer code, so that was probably your problem. I fixed it and reuploaded the demo.

Edit: I could also email the dll to anybody that wants it.

Share this comment

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Advertisement