src/video/windowsrt/SDL_winrtvideo.cpp
changeset 8334 09b0670fece4
parent 8333 49973bfb8d23
child 8335 4f41add2ff00
equal deleted inserted replaced
8333:49973bfb8d23 8334:09b0670fece4
   135 }
   135 }
   136 
   136 
   137 int
   137 int
   138 WINRT_CreateWindow(_THIS, SDL_Window * window)
   138 WINRT_CreateWindow(_THIS, SDL_Window * window)
   139 {
   139 {
   140     // TODO, WinRT: modify WINRT_Createwindow to ensure that, for now, only one window gets created
   140     // Make sure that only one window gets created, at least until multimonitor
   141     // (until multimonitor support is added to the WinRT port).
   141     // support is added.
       
   142     if (SDL_WinRTGlobalApp->HasSDLWindowData())
       
   143     {
       
   144         SDL_SetError("WinRT only supports one window");
       
   145         return -1;
       
   146     }
   142 
   147 
   143     SDL_WindowData *data;
   148     SDL_WindowData *data;
   144     data = (SDL_WindowData *) SDL_calloc(1, sizeof(*data));
   149     data = (SDL_WindowData *) SDL_calloc(1, sizeof(*data));
   145     if (!data) {
   150     if (!data) {
   146         SDL_OutOfMemory();
   151         SDL_OutOfMemory();
   161 }
   166 }
   162 
   167 
   163 void
   168 void
   164 WINRT_DestroyWindow(_THIS, SDL_Window * window)
   169 WINRT_DestroyWindow(_THIS, SDL_Window * window)
   165 {
   170 {
   166     SDL_WinRTGlobalApp->SetSDLWindowData(NULL);
   171     if (SDL_WinRTGlobalApp->HasSDLWindowData())
       
   172     {
       
   173         SDL_WinRTGlobalApp->SetSDLWindowData(NULL);
       
   174     }
   167 }
   175 }
   168 
   176 
   169 
   177 
   170 #endif /* SDL_VIDEO_DRIVER_WINRT */
   178 #endif /* SDL_VIDEO_DRIVER_WINRT */
   171 
   179