beginning SDL

closed account (jw6XoG1T)
For some reason, when the application works perfectly except it doesnt display the imgae. I put the bmp file in the same folder as the exe. however all that shows up is a black screen. Any help?

here's the code:

#include "SDL.h"


int main( int argc, char* args[] )
{
//The images
SDL_Surface* hello = NULL;
SDL_Surface* screen = NULL;

//Start SDL
SDL_Init( SDL_INIT_EVERYTHING );

//Set up screen
screen = SDL_SetVideoMode( 640, 480, 32, SDL_SWSURFACE );

//Load image
hello = SDL_LoadBMP( "hello.bmp" );

//Apply image to screen
SDL_BlitSurface( hello, NULL, screen, NULL );

//Update Screen
SDL_Flip( screen );

//Pause
SDL_Delay( 2000 );

//Free the loaded image
SDL_FreeSurface( hello );

//Quit SDL
SDL_Quit();

return 0;

}
Are you running from an IDE?

For many IDEs, the current directory is the project directory and not necessarily the same directory the .exe is in.
closed account (jw6XoG1T)
i tried that but it didnt work lol. I pretty much put it in every folder i could think of thats relevant to see if i would work but it still just shows up as a black screen.
Topic archived. No new replies allowed.