Thread: TextOut() flickering

  1. #1
    "The Oldest Member Here" Xterria's Avatar
    Join Date
    Sep 2001
    Location
    Buffalo, NY
    Posts
    1,039

    TextOut() flickering

    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.

    thanks

  2. #2
    Registered User VirtualAce's Avatar
    Join Date
    Aug 2001
    Posts
    9,607
    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.

  3. #3
    Registered User
    Join Date
    Apr 2002
    Posts
    1,571
    Are you drawing to the primary surface or the back buffer?
    "...the results are undefined, and we all know what "undefined" means: it means it works during development, it works during testing, and it blows up in your most important customers' faces." --Scott Meyers

  4. #4
    I am he who is the man! Stan100's Avatar
    Join Date
    Sep 2002
    Posts
    361
    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.
    Stan The Man. Beatles fan

    When I was a child,
    I spoke as a child,
    I thought as a child,
    I reasoned as a child.
    When I became a man,
    I put childish ways behind me"
    (the holy bible, Paul, in his first letter to the Cor. 13:11)

  5. #5
    "The Oldest Member Here" Xterria's Avatar
    Join Date
    Sep 2001
    Location
    Buffalo, NY
    Posts
    1,039
    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
    lpPrimary->TextOut()??
    i know you cant use it like that but that's al l i could think of.

  6. #6
    Registered User
    Join Date
    Apr 2002
    Posts
    1,571
    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.

    Code:
    // 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 );
    Try that out..
    "...the results are undefined, and we all know what "undefined" means: it means it works during development, it works during testing, and it blows up in your most important customers' faces." --Scott Meyers

  7. #7
    "The Oldest Member Here" Xterria's Avatar
    Join Date
    Sep 2001
    Location
    Buffalo, NY
    Posts
    1,039
    Mr wizard, your my new best friend

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Using TextOut() to align positive & negative numbers
    By csonx_p in forum Windows Programming
    Replies: 4
    Last Post: 05-27-2008, 07:12 AM
  2. flickering
    By ElastoManiac in forum Windows Programming
    Replies: 10
    Last Post: 12-23-2005, 08:26 AM
  3. Using TextOut to display variables
    By jmd15 in forum Windows Programming
    Replies: 4
    Last Post: 06-27-2005, 12:55 PM
  4. TextOut() Questions
    By Dipset in forum Windows Programming
    Replies: 2
    Last Post: 07-05-2003, 11:38 AM
  5. Flickering
    By Visu A in forum C Programming
    Replies: 1
    Last Post: 02-27-2002, 12:48 AM