Jump to content
  • Advertisement
Sign in to follow this  
bobthebobert

Loading an Image with DirectDraw/VB

This topic is 5143 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 am trying to create a function for my map editor that will allow me to load any .bmp file, without first describing it's dimensions statically. Ok, I am not sure if that made sense or not, so I will just show you an example of what I am talking about: (Note this is in VB)
ddsquare.lFlags = DDSD_CAPS
ddsquare.ddsCaps.lCaps = DDSCAPS_OFFSCREENPLAIN
ddsquare.lHeight = 32
ddsquare.lWidth = 32
Set square(intSquareAssign) = DD.CreateSurfaceFromFile(strTileFileNames(intSquareAssign), ddsquare)
Is there anyway that you could open up the .bmp file as a binary file and then get the dimensions that way? Or is there a simpler method to doing this? Sorta like this: [pseudo code] load pic.bmp read width read height ddsquare.lHeight = height ddsquare.lWidth = width [/pseudo code] Any help would be appreciated :)

Share this post


Link to post
Share on other sites
Advertisement
I'm not very familiar with DirectDraw itself, but I do know that the later DirectX stuff would accept a width and height of both 0. If they were both zero, then it would load the file and create a texture the was the same size as the image (well, maybe larger, depending on hardware requirements, but you're just working with surfaces, so this is likely irrelevant). You could then query the surface information to find out what size it was (and a structure could also optionally be filled in with information about the original file).

Read the docs closely, and you'll find that they often describe such behavior.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

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

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!