Jump to content
  • Advertisement
Sign in to follow this  
ankhd

.jpg files and ddraw7 surface

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

is there a way to put a anyimage.jpg file into a ddraw7 surface. the tut's only show pmb files.

Share this post


Link to post
Share on other sites
Advertisement
DirectDraw does not have any functions for loading images at all, you need to pass it raw image data, which means you're responsible for decoding the BMP / JPEG / PNG / whatever file, and passing DirectDraw the raw pixels (By locking the surface and copying them in).
To load JPEG files, you should look at libjpeg, there's pleanty of tutorials on the Internet.

However, I'd highly recommend using D3D for this. Not only does it provide a function to load most common image formats, but you can use "fake 3D" to make everything behave like it would in 2D, and you get free alpha blending, scaling and rotation, which you'd have to do by hand with DirectDraw.

Alternatively, if you feel you need to use DirectDraw, I'd suggest looking at SDL. It uses DirectDraw internally on Windows (Or it did the last time I checked), and there's SDL_image which will load JPEG files among others.

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.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!