SDL Window has blank title bar (OSX v10.11.6)

I’ve created a window on OSX but the title bar is blank; no widgets, no title, nothing. Any idea what I’m missing? Any help would be greatly appreciated;

The code is (almost entirely) cut & paste from Lazy Foo’s excellent tutorial website;

// Intitialize the SDL
    if (SDL_Init( SDL_INIT_VIDEO ) < 0){
        printf("SDL Could not be initialized! SDL Error %s\n", SDL_GetError() );
        success = false;
    }
    else {
        gWindow = SDL_CreateWindow("Rex Pictorum", SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, SCREEN_WIDTH,SCREEN_HEIGHT, SDL_WINDOW_SHOWN);
        SDL_SetWindowTitle(gWindow, "Rex Pictorum");
        
    }

Thanks in advance :slightly_smiling_face:

If all you’re doing is showing the window, waiting, and then closing the app (like as a test or something) then you have to pump the event queue before the window will be fully and properly created and shown on MacOS.

On an actual game this doesn’t matter, since you’ll be going through events anyway and so at most the window will show up one frame later or whatever, but until you get to the part where you learn about events, input handling, etc., just add

// go through the event queue once
SDL_Event event;
while(SDL_PollEvent(&event)) {
    // do nothing
}

after the code you posted.

That’s brilliant, thanks for your help! :slight_smile:

1 Like