🎉 Celebrating 25 Years of GameDev.net! 🎉

Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!

Windows Surface...

Started by
0 comments, last by King 24 years, 7 months ago
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

Advertisement
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);

This topic is closed to new replies.

Advertisement