• Advertisement

Archived

This topic is now archived and is closed to further replies.

Windows Surface...

This topic is 6748 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

CreateCompatibleBitmap is old! Try CreateDIBSection. To create...

BITMAPINFO bmi;
ZeroMemory(&bmi, sizeof(bmi));
bmi.bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
bmi.bmiHeader.biWidth = 1200;
bmi.bmiHeader.biHeight = 900;
bmi.bmiHeader.biBitCount = 32;
bmi.bmiHeader.biPlanes = 1;
HBITMAP hbm = CreateDIBSection(0, &bmi, DIB_RGB_COLORS, NULL, 0, 0);

... or something. To blit into it...

HDC hdc = CreateCompatibleDC(0);
SelectObject(hdc, hbm);
BitBlt(hdc, ... whatever ..., SRCCOPY);
DeleteDC(hdc);

.. to blit it into your window...

HDC hdc = CreateCompatibleDC(0);
SelectObject(hdc, hbm);
BitBlt(hdcWindow, 0, 0, 1200, 900, hdc, 0, 0, SRCCOPY);
DeleteDC(hdc);

Share this post


Link to post
Share on other sites
Advertisement
I'm trying to write a map maker for a 2d rpg game.... but i'm stuck because when i use the CreateCompatibleBitmap() or whatever its called to create a surface, i don't know how to blit 50x50 bitmaps on to it then back on the screen. i've tried:


hdcMem = GetDC (hWnd) ;
hBitmap = CreateCompatibleBitmap(hdcMem, 1200, 900) ;
ReleaseDC ( hWnd, hdcMem ) ;

this i'm told creates the surface, but i'm don't know where to go from there. Any help would be very much appreciated.

thanks
-King

MXF ENTERTAINMENT

Share this post


Link to post
Share on other sites

  • Advertisement