Jump to content

  • Log In with Google      Sign In   
  • Create Account


Bitmap Templates and Stuff


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
2 replies to this topic

#1 Peon   Members   -  Reputation: 276

Like
Likes
Like

Posted 06 August 2001 - 04:34 PM

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

Sponsor:

#2 Martee   Members   -  Reputation: 476

Like
Likes
Like

Posted 06 August 2001 - 04:43 PM

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

#3 Peon   Members   -  Reputation: 276

Like
Likes
Like

Posted 06 August 2001 - 05:32 PM

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




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS