[SDL] grief loading/getting xpm in function with char *

neil at cloudsprinter.com neil at cloudsprinter.com
Sat Mar 8 00:23:31 PST 2008


>> i've had this issue before, i'm sorry if it is blaringly obvious, but
>> how can i
>> pass my char to the funtion IMG_ReadXPMFromArray( char **xpm )
>>
>> right now my function does this
>>
>> SDL_Surface *getimage(int mask , char *name )
>> {
>> /snip/
>> strcat(name, "_xpm");
>> surface=IMG_ReadXPMFromArray(name);
>> /snip/
>> };
>> which gives
>> warning: passing argument 1 of ?IMG_ReadXPMFromArray? from incompatible
>> pointer type
>
>
> The IMG_ReadXPMFromArrary() function expects the entire file to already be
> in memory in a char array in memory. The function you want is IMG_Load()
> which takes one argument which the the path and name of the file that
> contains the .xpm. It will figure out that it is an XPM and load it. At
> least it will if XPM support is compiled into the image library. You could
> also use IMG_LoadXPM_RW() if you really want to make sure it treats the file
> as a .xpm file. Please google for these function names to find the
> documentation.
>

er.. still not sure what i am doing wrong..

i have a .h file being loaded/used with the arrays like this


static char *backg3_xpm[] = {
/* columns rows colors chars-per-pixel */
"200 200 256 2",
"   c #151417",
".  c #071835",

--- etc

i appended the _xpm because some of the image names are the same as thier
surfaces

if i use IMG_ReadXPMFromArray( backg3_xpm ); it will load fine, but i need to
make a function that i can use custom names, which i am failing on

agauin sorry if i a noobing out in some way, and sorry if i dint make my first
post clear about what my issues are



More information about the SDL mailing list