我在探测后将其缩小到SDL_DisplayFormat。我在Windows机器上用g++ -o test.exe test.cpp -lmingw32 -lSDLmain -lSDL -lSDL2_image
编译,使用msys,并运行可执行文件;然后echo $?
返回3 ...
int main( int argc, char **args ) {
int status = SDL_Init( SDL_INIT_EVERYTHING );
if ( status == -1 ) return 4;
screen = SDL_SetVideoMode( W_WIDTH, W_HEIGHT, BPP, SDL_SWSURFACE );
if ( screen == NULL ) return 44;
SDL_Surface *loaded_surface = IMG_Load( "./res/figure.png" );
if ( loaded_surface == NULL ) return 444;
SDL_Surface *background = SDL_DisplayFormat( loaded_surface );
return 5;
if ( background == NULL ) return 4444;
SDL_FreeSurface( loaded_surface );
SDL_BlitSurface( background, NULL, screen, NULL );
SDL_Flip( screen );
SDL_Delay( 2000 );
return 0;
}
答案 0 :(得分:0)
如上所述:can i use SDL-1.2.15 with SDL2-image extension?
SDL2_Image
与SDL 1.x
不兼容,您应该升级到SDL 2
。