Jump to content
  • Advertisement

Archived

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

Loading bitmap to a LPDIRECTDRAWSURFACE7

This topic is 5587 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

i looked at the tutorials and such on this site, and non of them seem to work for me. what i want to do is create a sprite (for now just an image that i can blt to the backbuffer). i have dx set up, and it runs at full screen mode (no flipping as of yet). i want to load a bitmap from a resource file (.rc) that i have in my project. does anyone have any ideas? source code maybe? thanks! i code therefore i am.

Share this post


Link to post
Share on other sites
Advertisement
check in the DX samples. I found ddutil.cpp DDLoadBitmap() in version DirectDraw 6.0 samples and use that constantly. You should find a version in DD7 samples.

ZoomBoy
Developing a iso-tile 2D RPG with skills, weapons, and adventure. See my old Hex-Tile RPG GAME, character editor, diary, 3D Art resources at Check out my web-site

Share this post


Link to post
Share on other sites
i looked up the DDLoadBitmap function in the dx help, but i always find the DX help extremely confusing. everyone says to go to the SDK documentation... but i think its horrible. i KINDA understand what the function does, but i dont really know how to implement it. also, because the return type is IDIRECTDRAWSURFACE7*, can that convert to LPDIRECTDRAWSURFACE7? if you could give me some sample code on how to use tha function it would help. in addition, does that function load a bitmap according to the id number in the resource file, ie 101? or the name of the file, ie "ship.bmp"??

thanks

i code therefore i am.

Share this post


Link to post
Share on other sites
To load a bitmap, first create a surface:
LPDIRECTDRAWSURFACE7 lpDDSSprite;

Then you have two options, LoadBitmap, or LoadImage. With LoadImage, you must also use DDCopyBitmap. With either one, you need to include the files ddutil.cpp and ddutil.h, if you don't have them, they shouldn't be too hard to find with google.

LoadBitmap:
  
lpDDSSprite = DDLoadBitmap(DirectDraw Object, name of image file (full directory), width of image, height of image);

ex:

lpDDSSprite = DDLoadBitmap(lpDD, "mpImage.bmp", 16, 16);


LoadImage:
HBITMAP temp = (HBITMAP)LoadImage(NULL, name of image file, IMAGE_BITMAP, width, height, LR_LOADFROMFILE | LR_CREATEDIBSECTION);

DDCopyBitmap:
(surface to copy to, surface to copy from, 0, 0, width of image, height of image)

[edited by - Sfpiano on February 2, 2003 4:59:12 PM]

[edited by - Sfpiano on February 2, 2003 4:59:51 PM]

[edited by - Sfpiano on February 2, 2003 5:00:43 PM]

[edited by - Sfpiano on February 2, 2003 5:01:32 PM]

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!