Jump to content
  • Advertisement

Archived

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

Woodsman

SDL: Loading BMP from a resource?

This topic is 5226 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 this possible? I''d like to not have to have a huge folder with media to distribute to others for testing but I can''t seem to find a way to handle bitmaps aside from the LoadBMP function, which only takes a file string as a parameter. Am I missing something? Cheers and thanks in advance.

Share this post


Link to post
Share on other sites
Advertisement
Vaugely remeber how to do this

SDL_LoadBMPRW or something like that exists, and it takes a RWops thinger.

There''e a from memory RWops that you can use ot read the BMP from a resource, just use the resource to get a location of a bmp from memory, then read it using that.

something like that

Share this post


Link to post
Share on other sites
Hmmm, thanks to your help I believe I've found what I'm looking for. It's funny that it appears to not be documented at all. Anyway, thanks much!

EDIT:
Well, here is what I've found. Just to be clear, in:

SDL_RWops *res_handle = SDL_RWFromMem( ptr_to_resource, size );

SDL_Surface *bitmap = SDL_LoadBMP_RW( res_handle, 1 );

would the ptr_to_resource be acquired through MAKEINTRESOURCE?

[edited by - woodsman on June 3, 2004 9:40:55 PM]

Share this post


Link to post
Share on other sites
quote:
Original post by TravisWells
I don''t do much win32 programming, but I think you''d have to use LockResource (to get a pointer)
EDIT: Probably SizeofResource too, since you need a size.

Ah, I''ll give that a try over the weekend. Thanks.

Share this post


Link to post
Share on other sites
SDL_RWFromMem requires a void* to the region of memory where the file has been read into, there''s probably a win32 function you can use to read the resource into memory but I''m no Win32 expert by any means so you could have a look on MSDN

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.

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!