Note that there are some explanatory texts on larger screens.

plurals
  1. POwin32 bitmaps flashing when more than one sprite on screen
    primarykey
    data
    text
    <p>I've been using the win32 api to make a game with sprites. For some reason when I have more than one sprite on screen they flash occasionally as if they are disappearing and returning. When there is only one sprite on screen it displays correctly.</p> <p>I am using C++, win32 API and working with Visual Studio 08</p> <p>The following is roughly what I have:</p> <pre><code>//creates rect based on window client area GetClientRect(ghwnd, &amp;screenRect); // Initialises front buffer device context (window) frontHDC = GetDC(ghwnd); // sets up Back DC to be compatible with the front backHDC = CreateCompatibleDC(frontHDC); // Create another hdc to store the bitmap in before the backbuffer bitmapHDC = CreateCompatibleDC(frontHDC); //creates bitmap compatible with the front buffer theOldFrontBitMap = CreateCompatibleBitmap(frontHDC, screenRect.right, screenRect.bottom); //creates bitmap compatible with the back buffer theOldBackBitMap = (HBITMAP)SelectObject(backHDC, theOldFrontBitMap); HBITMAP originalBitMap = (HBITMAP)SelectObject(bitmapHDC,bitmap); //Transparency function TransparentBlt( backHDC, m_Position.x, m_Position.y, m_Size.x, m_Size.y, bitmapHDC, 0, 0, m_Size.x, m_Size.y, 0x00FFFFFF); SelectObject(bitmapHDC,originalBitMap); BitBlt(frontHDC, screenRect.left, screenRect.top, screenRect.right, screenRect.bottom, backHDC, 0, 0, SRCCOPY); </code></pre> <p>Am I doing this correctly? and if so where am I going wrong? If I have not given enough information please tell me and I will rectify that.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload