SDL Lazyfoo help..

I was going through Lazyfoo's tutorial, (lazyfoo.net/SDL_tutorials/lesson01/index2.php) and my sdl window flashes for 2 seconds and doesn't show an image. can someone tell me what went wrong? ps: i have my image saved as a .bmp on my desktop, and im using xcode. here is my code:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
  #include "SDL/SDL.h"
#include <iostream>

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;
    
    
}   
Did you try specifying the full path to hello.bmp?
Topic archived. No new replies allowed.