Hey, i was wondering if there was a way to stop the flickering text with TextOut(). I'm using DirectDraw in fullscreen mode and almost every pixel is colored--if that means anything. I've been using TextOut() for variable tests and such, but now i am using it for text output in the final version of the game. The thing just keeps flickering regardless of what i do. the Textout is located within the game loop, not in WM_PAINT. I've tried wmpaint too but there's no difference.
Sounds like the window is repainting itself for some reason. Try to intercept the WM_PAINT message and make sure you tell Windows that you do not want it to auto-update your window. Windows will auto-update it when another operation by either your app or another might obliterate your window.
It will send a message to repaint the window and you can intercept this message and do what you want with it.
Are you drawing to the primary surface or the back buffer?
You are using double buffering, I assume. Then again, you know what they say when you assume.
It sounds like you're blitting to the wrong buffer. Try switching it.
how can you use TextOut() with a buffer?
as you can see, I'm new with windows programming
theres a primary and backbuffer, so to use a buffer do you use
i know you cant use it like that but that's al l i could think of.
You simply get the DC of the back buffer then use that in your TextOut call. Here's a snippet from something I wrote a long time ago.
Try that out..
// Get the back buffer's DC
pDDBack->GetDC( &hdc );
// Set the text to be red
SetTextColor(hdc, RGB(255, 0, 0));
// Write the text transparently
SetBkMode(hdc, TRANSPARENT );
// Actually write the text on the surface
TextOut( hdc, 10, 7, cBuffer, strlen( cBuffer ) );
// Release the DC
pDDBack->ReleaseDC( hdc );
Mr wizard, your my new best friend