BackBuffer::BackBuffer(HWND hWnd, intwidth, intheight)
mhWnd = hWnd;
HDC hWndDC = GetDC(hWnd);
mWidth = width;
mHeight = height;
mhDC = CreateCompatibleDC(hWndDC);
mhSurface = CreateCompatibleBitmap(
hWndDC, width, height);
ReleaseDC(hWnd, hWndDC); // when release the DC, does mhDC and mhSurface still bounding with the hWndDC? don't we just make use of the hWndDC? use it, and then get rid of it?
mhOldObject = (HBITMAP)SelectObject(mhDC, mhSurface); // select object first
// why use the white brush, I mean, we can just ignore this, because default is white.
// initialize the backbuffer to non-zero
HBRUSH white = (HBRUSH)GetStockObject(WHITE_BRUSH);
HBRUSH oldBrush = (HBRUSH)SelectObject(mhDC, white); // when use it second, won't overwrites the first? or not the same type,
//won't overwrites? if the second use of SelectObject's
//second parameter is HBITMAP like first, will overwrites?
Rectangle(mhDC, 0, 0, mWidth, mHeight); // what does the mhDC mean? it just initialized by CreateCompatibleDC(hWndDC) as a system DC
//I think in this line, it means the DC to the buffer window. is it?
//I think draw a rectangle will draw the black outline, right?