dcsimg
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2

Thread: Avoiding drawings from one device context from overwriting another one?

  1. #1
    Join Date
    Dec 2010
    Posts
    114

    Avoiding drawings from one device context from overwriting another one?

    First, I've got 2 separate device contexts to draw on, they are both static images. However, one of them is going to be moved around. As usual, these 2 device contexts is updated on a game loop,
    the "moving" device context is underneath the "static" context above it, but as the game loop is running so fast, it begins to flicker.
    So currently, I am drawing these 2 device contexts into a final context, and I blit out the final context every frame. But it still flickers, any ideas how I can fix this?
    If I have already used the "final" context when doing the blitting, am I already using a double-buffering technique?
    thanks
    Jack

  2. #2
    Join Date
    Nov 2003
    Location
    Belgium
    Posts
    8,119

    Re: Avoiding drawings from one device context from overwriting another one?

    You should look into memory device context.
    Prepare your entire frame in a memory device context, then blit that one to the screen.
    The result is flicker-free animation.
    Marc Gregoire - NuonSoft (http://www.nuonsoft.com)
    My Blog
    Wallpaper Cycler 3.5.0.97

    Author of Professional C++, 4th Edition by Wiley/Wrox (includes C++17 features)
    ISBN: 978-1-119-42130-6
    [ http://www.facebook.com/professionalcpp ]

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Windows Mobile Development Center


Click Here to Expand Forum to Full Width




On-Demand Webinars (sponsored)