Wiki Page Content

Differences between revisions 2 and 3
Revision 2 as of 2010-06-17 04:24:08
Size: 942
Editor: SheenaSmith
Comment: add content from old wiki (incomplete)
Revision 3 as of 2010-06-17 04:34:46
Size: 1274
Editor: SheenaSmith
Comment: add content from old wiki
Deletions are marked like this. Additions are marked like this.
Line 17: Line 17:
||'''mem'''||^a pointer to a memory construct containing the information to fill an [[SDL_RWops]] structure with^|| ||'''mem'''||^a pointer to a memory location to use for an SDL_RWops structure^ ???||
Line 21: Line 21:
A pointer to the [[SDL_RWops]] structure that is created. *Returns a pointer to a new ^SDL_^RWops structure, or NULL if it fails. *
Line 24: Line 24:
*
Line 25: Line 26:
You can add your code example here 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...
Line 27: Line 37:
*
Line 29: Line 40:
''You can add useful comments here'' *[[SDL_RWFromConstMem]]() sets up a ^SDL_^RWops struct based on a memory area of a certain size. It assumes the memory area is not writable. *
Line 32: Line 43:
 .[[SDL_FreeRW]] *
Line 34: Line 46:
 .[[SDL_RWFromMem]] ???  .[[SDL_RWFromMem]] *

DRAFT

SDL_RWFromConstMem

Use this function to *prepare a constant memory area for use with RWops. *

Syntax

SDL_RWops* SDL_RWFromConstMem(const void* mem,
                              int         size)

Function Parameters

mem

a pointer to a memory location to use for an SDL_RWops structure ???

size

the size of the memory location ???

Return Value

*Returns a pointer to a new SDL_RWops structure, or NULL if it fails. *

Code Examples

*

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...

*

Remarks

*SDL_RWFromConstMem() sets up a SDL_RWops struct based on a memory area of a certain size. It assumes the memory area is not writable. *


CategoryAPI, CategoryIO

None: SDL_RWFromConstMem (last edited 2015-04-26 19:16:57 by PhilippWiesemann)

(Page Info.)
Feedback
Please include your contact information if you'd like to receive a reply.
Submit