Archived

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

Peon

Bitmap Templates and Stuff

Recommended Posts

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

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites