Jump to content
  • Advertisement
  • entries
    707
  • comments
    1173
  • views
    435836

Font Engine Demo

Sign in to follow this  
Programmer16

367 views

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()
{
g_Timer.Start();
dftin::DirectInput::GetSingleton()->Update();
dftgfx::Direct3D::GetSingleton()->GetDeviceComPtr()->Clear(0, 0, D3DCLEAR_TARGET, 0xff000000, 1.0f, 0);
dftgfx::Direct3D::GetSingleton()->GetDeviceComPtr()->BeginScene();

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)
{
++nTalkingIndex;
if(nTalkingIndex > 3)
nTalkingIndex = 0;
fTalkingTime = 0.0f;
}

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

if(bDone)
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()->EndScene();
dftgfx::Direct3D::GetSingleton()->GetDeviceComPtr()->Present(0, 0, 0, 0);
g_Timer.End();
}


Sign in to follow this  


3 Comments


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
×

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!