Screen Problem

Im having a problem when i compiled my code..the code works but when i compiled it the screen only pops out / SDL screen only pop's up and immediately close.. i tried searching for what is the problem in google and other forum but no luck.

help! btw im using code::blocks and SDL-1.2.15

here is the code the code is fairly simple, but i cant move forward if i cant figure out the problem.. again the code is running fine but the screen popping and closing immediately was the problem.

and is it possible for it to be a problem in my hard drive or memory/memory leaks? ?

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
 #include "SDL/SDL.h"

int main(int argc, char** argv){
    SDL_Init(SDL_INIT_EVERYTHING);
    SDL_WM_SetCaption("Yay", NULL);

    SDL_Surface *buffer;
    bool fullscreen = false;

    if(fullscreen == false){
        buffer = SDL_SetVideoMode(640,480,32, SDL_SWSURFACE  );
    }
    else{
        buffer = SDL_SetVideoMode(640,480,32, SDL_SWSURFACE | SDL_FULLSCREEN);
    }

    SDL_Delay(2000);

    SDL_Quit();
    return 0;
}
Last edited on
Well your program is working perfectly fine, in that it's not actually doing anything. You'll have to initialize a loop before your window will actually stay up. See this example (and the rest of the site) for more: http://code.bluedinosaurs.com/beginners/sample%20SDL.cpp
Topic archived. No new replies allowed.