src/video/SDL_video.c
changeset 10312 943b722a8e61
parent 10166 2393160743ca
child 10385 ad12658bc7ae
equal deleted inserted replaced
10311:848951113551 10312:943b722a8e61
    51 #endif
    51 #endif
    52 
    52 
    53 /* On Windows, windows.h defines CreateWindow */
    53 /* On Windows, windows.h defines CreateWindow */
    54 #ifdef CreateWindow
    54 #ifdef CreateWindow
    55 #undef CreateWindow
    55 #undef CreateWindow
       
    56 #endif
       
    57 
       
    58 #ifdef __EMSCRIPTEN__
       
    59 #include <emscripten.h>
    56 #endif
    60 #endif
    57 
    61 
    58 /* Available video drivers */
    62 /* Available video drivers */
    59 static VideoBootStrap *bootstrap[] = {
    63 static VideoBootStrap *bootstrap[] = {
    60 #if SDL_VIDEO_DRIVER_COCOA
    64 #if SDL_VIDEO_DRIVER_COCOA
  3720 }
  3724 }
  3721 
  3725 
  3722 int
  3726 int
  3723 SDL_ShowSimpleMessageBox(Uint32 flags, const char *title, const char *message, SDL_Window *window)
  3727 SDL_ShowSimpleMessageBox(Uint32 flags, const char *title, const char *message, SDL_Window *window)
  3724 {
  3728 {
       
  3729 #ifdef __EMSCRIPTEN__
       
  3730     /* !!! FIXME: propose a browser API for this, get this #ifdef out of here? */
       
  3731     /* Web browsers don't (currently) have an API for a custom message box
       
  3732        that can block, but for the most common case (SDL_ShowSimpleMessageBox),
       
  3733        we can use the standard Javascript alert() function. */
       
  3734     EM_ASM_({
       
  3735         alert(UTF8ToString($0) + "\n\n" + UTF8ToString($1));
       
  3736     }, title, message);
       
  3737     return 0;
       
  3738 #else
  3725     SDL_MessageBoxData data;
  3739     SDL_MessageBoxData data;
  3726     SDL_MessageBoxButtonData button;
  3740     SDL_MessageBoxButtonData button;
  3727 
  3741 
  3728     SDL_zero(data);
  3742     SDL_zero(data);
  3729     data.flags = flags;
  3743     data.flags = flags;
  3737     button.flags |= SDL_MESSAGEBOX_BUTTON_RETURNKEY_DEFAULT;
  3751     button.flags |= SDL_MESSAGEBOX_BUTTON_RETURNKEY_DEFAULT;
  3738     button.flags |= SDL_MESSAGEBOX_BUTTON_ESCAPEKEY_DEFAULT;
  3752     button.flags |= SDL_MESSAGEBOX_BUTTON_ESCAPEKEY_DEFAULT;
  3739     button.text = "OK";
  3753     button.text = "OK";
  3740 
  3754 
  3741     return SDL_ShowMessageBox(&data, NULL);
  3755     return SDL_ShowMessageBox(&data, NULL);
       
  3756 #endif
  3742 }
  3757 }
  3743 
  3758 
  3744 SDL_bool
  3759 SDL_bool
  3745 SDL_ShouldAllowTopmost(void)
  3760 SDL_ShouldAllowTopmost(void)
  3746 {
  3761 {