Drawing Text in DirectDraw
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?
... 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?
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?
If its jittery the youre doing something wrong. Havent done DDraw for a while I look it up just a sec.
-CProgrammer
-CProgrammer
Ok its like this:
-CProgrammer
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.
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.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement