Sign in to follow this  
dist0rted

Drawing Text in DirectDraw

Recommended Posts

I've got everything set up in DirectDraw7 and have a bitmap and background blitted and flipped every time the main loop runs. But how can I draw text to the screen without it looking all jittery and faded in color?

Share this post


Link to post
Share on other sites
... I did use TextOut ... I have no problem outputting the text ...

It's getting it to not look so god damn jittery and dimmed because of it being blitted over and over. Is there any way I can BltFast() it to the backbuffer?

Share this post


Link to post
Share on other sites
Ok its like this:


if(lpBackBuffer->GetDC(&hdc) == DD_OK)
{
//drawing goes here

//after all the drawing display text://something like this:
SetBkMode(hdc, TRANSPARENT);
SetTextColor(hdc, RGB(255, 0, 0));
TextOut(hdc, 2, 2, "Something", 6);

lpBackBuffer->ReleaseDC(hdc);
}
lpPrimarySurface->Flip(NULL, 0);


-CProgrammer

Share this post


Link to post
Share on other sites
You will find using GDI to draw text will be somewhat of a bottle neck down the road if you do much text manipulation. Depending on how much text is drawn to the screen and how much it changes, you might want to TextOut your text to an offscreen buffer when you initialize it and then again only when it changes and use DDraw's Blt to draw the offscreen surface to the backbuffer for repeats. Blittin the surface once tends to be much faster than a textout call. I used DDraw for about a year or so and it was always on slower machines so speaking from experience, those GDI TextOut calls are a bottleneck that can be pretty annoying.

Share this post


Link to post
Share on other sites

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

Sign in to follow this