Jump to content
  • Advertisement
Sign in to follow this  

SDL Datafiles?

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

The short answer is no, not really. Consider using an additional library like PhysFS.

The long answer is that SDL (and some SDL add-on libraries like SDL_Image and SDL_Mixer) uses a structure called SDL_RWops to abstract away access to and from arbitrary resource locations such as files, memory structures or other resource systems. It contains a number of function pointers and bookkeeping information that can be filled in to allow SDL functions like SDL_LoadBMP_RW() to read from any resource location. However, by itself, SDL only can create SDL_RWops structures that interface with files and memory blocks. To use SDL_RWops to interface with other resources you need to either write the code to read the resource into memory and then use SDL_RWFromMem() to access that memory or use the undocumented function pointer information to access the resource directly. In general, it's more convenient to use a library like PhysFS that's already done the work of translating reading from resources to a form that SDL can work with.

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!