# Drawing Text in DirectDraw

This topic is 4947 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## 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 on other sites
You can just use TextOut.
And if you want to change the color use HBRUSH.

-CProgrammer

##### 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 on other sites
If its jittery the youre doing something wrong. Havent done DDraw for a while I look it up just a sec.

-CProgrammer

##### 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 on other sites
It sounds to me like the text is only on one of the buffers, and the constant flipping makes it appear and disappear very quickly, making it look dim and jittery.

##### Share on other sites
The text wasn't on a buffer period. Thanks to CProgrammer now it's blitted normally. Thanks dude.

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