Drawing Text in DirectDraw

Started by
7 comments, last by evillive2 19 years, 8 months ago
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?
=============================All knowledge is good; only the way it is put to use is good or evil.
Advertisement
You can just use TextOut.
And if you want to change the color use HBRUSH.

-CProgrammer
Create your own font engine.
... 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?
=============================All knowledge is good; only the way it is put to use is good or evil.
If its jittery the youre doing something wrong. Havent done DDraw for a while I look it up just a sec.

-CProgrammer
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
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.
The text wasn't on a buffer period. Thanks to CProgrammer now it's blitted normally. Thanks dude.
=============================All knowledge is good; only the way it is put to use is good or evil.
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.

Evillive2

This topic is closed to new replies.

Advertisement