I'm making a game in windows. MY game has many child windows, and it does double buffering.
i'm using WS_CLIPCHILDREN, so that my children is visible next to buffering.
Double buffering only happens when screen is updated, for example when you select something in
Double buffering isn't constant. it is executed only when needed, thats about 3 times in 10 seconds.
So heres my problem:
I run my app, and i play with my children. every time i do something about them double buffering
does it's work. After some time, my children are wasted ( they are misplaced, and my whole app
So i gues there is something wrong in the double buffering... so i ask you is this right:
// this is happening when screen is updated
I don't know where else the error could be, all my PENS, BRUSHES, BITMAPS are created when programCode:HDC image_dc = CreateCompatibleDC(hDC); SelectObject(image_dc, paint.BMP1); BitBlt(hDC, x, y, x1, y1, image_dc, 0, 0, SRCCOPY); DeleteObject(image_dc);
is executed and destroyed when program is quiting.
All my child windows are created with CreateWindowEx() and destroyed with DestroyWindow()
All my pens, brushes, bitmaps, fonts are destroyed with DeleteObject()
I could give you my code, but it has many files with many classes, so it wouldn't be a good idea...
I have done some filtering and came to conclusion, when it does work. I have deleted a part of my code
which load a BITMAP, the part of code is in double buffering.
There is aand whenever i need to draw something i load stuff into thatCode:HBITMAP buffer
bitmap. I load image in that bitmap about 20 times in a loop.
Is this ok? Should i do something with this BMP?