Sign in to follow this  

SDL Datafiles?

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

This topic is 3596 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.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this