SDL - not loading an image
This is the first time I'm trying out separating my files into 4 folders: images, source, sounds, headers. My problem is: I'm trying to load a trivial BMP from the images folder that has been called on by a file in the source folder. Here is my code:
#include <SDL/SDL.h> int main(int argc, char *argv[]) { SDL_Surface *hello = NULL; SDL_Surface *screen = NULL; screen = SDL_SetVideoMode(640, 480, 32, SDL_SWSURFACE); hello = SDL_LoadBMP("../images/hello.bmp"); SDL_BlitSurface(hello, NULL, screen, NULL); SDL_Flip(screen); SDL_Delay(2000); SDL_FreeSurface(hello); SDL_Quit(); return 0; }
Apparently, the c开发者_高级运维all "../images/hello.bmp" isn't working.
I think you forgot to call SDL_Init()
.
精彩评论