- sdl_texture = SDL_CreateTexture(sdl_renderer,
- SDL_PIXELFORMAT_ARGB8888,
- SDL_TEXTUREACCESS_STREAMING,
- width, height);
-
- if (sdl_texture != NULL)
- {
-#if 1
- // (do not use alpha channel)
- new_surface = SDL_CreateRGBSurface(0, width, height, 32,
- 0x00FF0000,
- 0x0000FF00,
- 0x000000FF,
- 0x00000000);
-#else
- // (this uses an alpha channel, which we don't want here)
- new_surface = SDL_CreateRGBSurface(0, width, height, 32,
- 0x00FF0000,
- 0x0000FF00,
- 0x000000FF,
- 0xFF000000);
-#endif
-
- if (new_surface == NULL)
- Error(ERR_WARN, "SDL_CreateRGBSurface() failed: %s",
- SDL_GetError());
- }
- else
- {
- Error(ERR_WARN, "SDL_CreateTexture() failed: %s", SDL_GetError());
- }
- }
- else
- {
- Error(ERR_WARN, "SDL_CreateRenderer() failed: %s", SDL_GetError());
- }
- }
- else
- {
- Error(ERR_WARN, "SDL_CreateWindow() failed: %s", SDL_GetError());
- }
-
-#else
-
- if (sdl_window)
- SDL_DestroyWindow(sdl_window);
-
- sdl_window = SDL_CreateWindow(program.window_title,
- SDL_WINDOWPOS_CENTERED,
- SDL_WINDOWPOS_CENTERED,
- width, height,
- surface_flags);
-
- if (sdl_window != NULL)
- new_surface = SDL_GetWindowSurface(sdl_window);
-#endif
-
-#else
- new_surface = SDL_SetVideoMode(width, height, video.depth, surface_flags);
-#endif
-
-#if defined(TARGET_SDL2)
- // store fullscreen state ("video.fullscreen_enabled" may not reflect this!)
- if (new_surface != NULL)
- fullscreen_enabled = fullscreen;
-#endif
-
- return new_surface;
-}
-
-boolean SDLSetVideoMode(DrawBuffer **backbuffer, boolean fullscreen)
-{
- boolean success = TRUE;
-#if 1
-#else
-#if defined(TARGET_SDL2)
- // int surface_flags_fullscreen = SURFACE_FLAGS | SDL_WINDOW_FULLSCREEN;
- int surface_flags_fullscreen = SURFACE_FLAGS | SDL_WINDOW_FULLSCREEN_DESKTOP;
- int surface_flags_window = SURFACE_FLAGS;
-#else
- int surface_flags_fullscreen = SURFACE_FLAGS | SDL_FULLSCREEN;
- int surface_flags_window = SURFACE_FLAGS;
-#endif
-#endif
- SDL_Surface *new_surface = NULL;
-
- SetWindowTitle();
-
- if (*backbuffer == NULL)
- *backbuffer = CreateBitmapStruct();
-
- /* (real bitmap might be larger in fullscreen mode with video offsets) */
- (*backbuffer)->width = video.width;
- (*backbuffer)->height = video.height;
-
- if (fullscreen && !video.fullscreen_enabled && video.fullscreen_available)
- {
- setFullscreenParameters(setup.fullscreen_mode);
-
- video_xoffset = fullscreen_xoffset;
- video_yoffset = fullscreen_yoffset;
-
- /* switch display to fullscreen mode, if available */
-#if 1
- new_surface = SDLCreateScreen(backbuffer, TRUE);
-#else
-
-#if defined(TARGET_SDL2)
- sdl_window = SDL_CreateWindow(program.window_title,
- SDL_WINDOWPOS_CENTERED,
- SDL_WINDOWPOS_CENTERED,
- fullscreen_width, fullscreen_height,
- surface_flags_fullscreen);
- if (sdl_window != NULL)
- {
- new_surface = SDL_GetWindowSurface(sdl_window);