Why does screen have a value of NULL, when it has a value?
Why does screen have a value of NULL in the if statement, when it really has a value?
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
|
bool init()
{
//Initialize all SDL subsystems
if( SDL_Init( SDL_INIT_EVERYTHING ) == -1 )
{
return false;
}
//Set up the screen
screen = SDL_SetVideoMode( SCREEN_WIDTH, SCREEN_HEIGHT, SCREEN_BPP, SDL_SWSURFACE );
// If screen setup did not work
if(screen == NULL);
{
cout << "screen = NULL | " << screen << endl;
}
// Set the caption on the window
SDL_WM_SetCaption("Test", NULL);
return true;
}
|
What does SDL_GetError() say? What is the value of NULL?
You know what, I accidently put a semicolon after the if state. The cout happened automatically.
Topic archived. No new replies allowed.