• Advertisement
Sign in to follow this  

SDL Datafiles?

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

Advertisement
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