|
|
|
@ -6,7 +6,7 @@ |
|
|
|
|
DIM AS CHAR string[128]; // String used by txtIt & SDL_ttf
|
|
|
|
|
|
|
|
|
|
// Conver Variable Argument into a string
|
|
|
|
|
SUB txtIt(char *pStr , ...) BEGIN |
|
|
|
|
SUB txtIt(const char *pStr , ...) BEGIN |
|
|
|
|
DIM AS va_list valist; // Type to hold information about variable arguments
|
|
|
|
|
va_start(valist, pStr); // Initialize a variable argument list
|
|
|
|
|
vsprintf( string , pStr , valist ); // Print formatted variable argument list to string
|
|
|
|
@ -33,11 +33,11 @@ ENDSUB |
|
|
|
|
// This function load a image file to a surface
|
|
|
|
|
// Set bCKey with colorkey (R,G,B) to clear a color on the image
|
|
|
|
|
// Set alpha value FOR transparency 0(No transparent) ~ 255(Ivisible)
|
|
|
|
|
FUNCTION SDL_Surface *ImgLoader(char *file, BOOL bCKey, INT r, INT g, INT b, INT alpha) BEGIN |
|
|
|
|
FUNCTION SDL_Surface *ImgLoader(CSTRING file, BOOL bCKey, INT r, INT g, INT b, INT alpha) BEGIN |
|
|
|
|
SDL_Surface *pic; |
|
|
|
|
pic = IMG_Load(file); // From SDL_image.h , load the image to pic
|
|
|
|
|
pic = IMG_Load(file.c_str()); // From SDL_image.h , load the image to pic
|
|
|
|
|
IF (pic==NULL) THEN |
|
|
|
|
fprintf(stderr,"Missing image %s : %s\n",file,IMG_GetError()); |
|
|
|
|
fprintf(stderr,"Missing image %s : %s\n",file.c_str(),IMG_GetError()); |
|
|
|
|
ENDIF |
|
|
|
|
IF ( bCKey ) THEN |
|
|
|
|
SDL_SetColorKey(pic,SDL_SRCCOLORKEY|SDL_RLEACCEL,SDL_MapRGB(pic->format,r,g,b)); |
|
|
|
@ -50,13 +50,13 @@ FUNCTION SDL_Surface *ImgLoader(char *file, BOOL bCKey, INT r, INT g, INT b, INT |
|
|
|
|
ENDFUNCTION |
|
|
|
|
|
|
|
|
|
// Load a normal picture into a surface
|
|
|
|
|
FUNCTION SDL_Surface *ImgLoader(LPCHAR file) BEGIN
|
|
|
|
|
RETURN ImgLoader(file,1,0,0,0,0) ;
|
|
|
|
|
FUNCTION SDL_Surface *ImgLoader(CSTRING file) BEGIN |
|
|
|
|
RETURN ImgLoader(file.c_str(),1,0,0,0,0) ; |
|
|
|
|
ENDFUNCTION |
|
|
|
|
|
|
|
|
|
// Load a pic & set the transparent color to (255,255,255) , no alpha
|
|
|
|
|
FUNCTION SDL_Surface *ImgLoader(char *file,bool bCKey) BEGIN |
|
|
|
|
RETURN ImgLoader(file,1,255,255,255,0) ;
|
|
|
|
|
FUNCTION SDL_Surface *ImgLoader(CSTRING file,bool bCKey) BEGIN |
|
|
|
|
RETURN ImgLoader(file.c_str(),1,255,255,255,0) ; |
|
|
|
|
ENDFUNCTION |
|
|
|
|
|
|
|
|
|
|
|
|
|
|