SDL_RWFromConstMem
Name
SDL_RWFromConstMem -- prepares a constant memory area for use with RWops.
Synopsis
#include "SDL.h" SDL_RWops *SDL_RWFromConstMem(const void *mem, int size);
Description
SDL_RWFromConstMem sets up a RWops struct based on a memory area of a certain size. It assumes the memory area is not writable.
Return Value
Returns a pointer to a new RWops struct, or NULL if it fails.
Example
char bitmap[] = {
66, 77, 86, 2, 0, 0, 0, 0 ...
}
SDL_RWops *rw;
SDL_Surface *img;
rw = SDL_RWFromConstMem(bitmap, sizeof(bitmap));
img = SDL_LoadBMP_RW(rw, 1); // Automatically frees the RWops struct for us
// Do something with img...
