c - Border/Titlebar not properly displaying in SDL OSX -


i following lazyfoo's sdl tutorial , ran sample code shown here:

#include <sdl2/sdl.h> #include <stdio.h>  //screen dimension constants const int screen_width = 640; const int screen_height = 480;  int main( int argc, char* args[] ) {     //the window we'll rendering     sdl_window* window = null;      //the surface contained window     sdl_surface* screensurface = null;      //initialize sdl     if( sdl_init( sdl_init_video ) < 0 )     {         printf( "failed initialise sdl! sdl_error: %s\n", sdl_geterror() );     }     else     {         //create window         window = sdl_createwindow( "sdl tutorial", sdl_windowpos_undefined, sdl_windowpos_undefined, screen_width, screen_height, sdl_window_shown );         if( window == null )         {             printf( "failed create window! sdl_error: %s\n",     sdl_geterror() );         }         else         {             //get window surface             screensurface = sdl_getwindowsurface( window );              //fill surface white             sdl_fillrect( screensurface, null, sdl_maprgb( screensurface->format, 255, 0, 0 ) );              //update surface             sdl_updatewindowsurface( window );              //wait 2 seconds             sdl_delay( 2000 );         }     }      //destroy window     sdl_destroywindow( window );      //quit sdl subsystems     sdl_quit();      return 0; } 

but reason no real border or title bar being shown, displays white screen. tried using sdl_setwindowbordered did nothing. next set background colour red , image can see there titlebar there no close or minimize button.window know why happening. me or problem mac's?

since getting rid of sdl_delay seemed help, try elaborate little. if @ code of sdl_delay can see 2 things:

  • if nanosleep() can utilized, sleep time interval;
  • else, runs in infinite while loop, checking how time has passed @ each iteration, , breaking out of loop after enough time has passed.

now, must have never coded osx, not know how draw it's windows. can assume reason sdl_delay in code gets called (and blocks thread it's called from) before os manages draw header of window, , after delay finishes destroy window yourself, header never drawn.


Comments

Popular posts from this blog

angular - Is it possible to get native element for formControl? -

unity3d - Rotate an object to face an opposite direction -

javascript - Why jQuery Select box change event is now working? -