Home > Back-end >  The IMG_Load cannot read. PNG format images, how to deal with, be urgent!!!!!!
The IMG_Load cannot read. PNG format images, how to deal with, be urgent!!!!!!

Time:03-04

 # define SDL_MAIN_HANDLED 
# include "SDL. H"
# include "SDL_image. H"
#include
using namespace std;
Int main (int arg c, char * argv []) {
SDL_Init (SDL_INIT_VIDEO);
SDL_Window * WINDOW=SDL_CreateWindow (" WINDOW ", SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, 800, 600, SDL_WINDOW_SHOWN);

SDL_Rect the rect.
The rect. X=the rect. Y=0;

SDL_Surface * surface=SDL_GetWindowSurface (Windows);
SDL_Surface * image=IMG_Load (" hello. PNG ");

If (image==NULL) {
SDL_GetError ();
return -1;
}

SDL_BlitSurface (image, NULL, surface, & amp; The rect);


SDL_UpdateWindowSurface (Windows);

SDL_Delay (3000);
SDL_FreeSurface (surface);
SDL_FreeSurface (image);
SDL_DestroyWindow (Windows);
SDL_Quit ();
return 0;
}

14 the IMG_Load cannot read. PNG format images is what problem?

CodePudding user response:

The IMG_Load (" hello. PNG ");
=================
The path into an absolute path to try?
  • Related