Advertisement

Bitmap Templates and Stuff

Started by August 06, 2001 10:34 PM
1 comment, last by Peon 23 years, 3 months ago
Sigh... After a long exhausting road, I finally loaded my first bitmap. Here is the code I used:
  
HDC compatible = GetDC(hwnd);

	HDC hdcMem = CreateCompatibleDC(compatible);

	ReleaseDC(hwnd, compatible);

	HBITMAP hbmNew = (HBITMAP)LoadImage(NULL, "boat.bmp", IMAGE_BITMAP, 0, 0, LR_LOADFROMFILE);

	HBITMAP hbmOld = (HBITMAP)SelectObject(hdcMem, hbmNew);

	BitBlt(compatible, 0, 0, 300, 300, hdcMem,            0, 0, SRCCOPY);  
I don''t really UNDERSTAND this all yet, but I just got it done and I''m too happy to think about it (If someone could explain the need for CreateCompatibleDC, I''d really appreciate it!) Anyway, seeing as how I haven''t really thought about it yet, but using the method I have used above, is it relatively easy to load templated bitmaps for animation sequences and stuff? Because I was hoping to do some kind of platformer and I was hoping to use templated bitmaps so that I dont end up loading 5-10 frames for a simple run cycle. In short, can I load and blit animation sequences from a templated .bmp with this method? thanks again Peon
Peon
See, the thing is, you''re using GDI, which isn''t known for its speed. Although you may be able to do some bitmap wizardry and run an animation at a reasonable frame rate, you might want to consider switching to DirectDraw.

~~~~~~~~~~
Martee
ReactOS - an Open-source operating system compatible with Windows NT apps and drivers
Advertisement
Ah okay... See, this is the kind of thing I wanted to know before I dive into an actual game Actually, I AM using DirectX (this part isn't but most of the code I have been experimenting with recently is) Is there some sort of directX function like LoadImage() that would give me good speed but be easy enough that I dont have to go too deep in the technical stuff?

EDIT: Well, I did a little research on old topics to find out a little more... It seems like most people suggested the function:

DDLoadBitmap()

Is this something that is something that I should look into (and reasonably painless)?

Edited by - Peon on August 6, 2001 12:46:37 AM
Peon

This topic is closed to new replies.

Advertisement