+#if defined(TARGET_SDL2)
+
+#if 1
+ float scale_factor = 1;
+ int test_fullscreen = 0;
+ int surface_flags = (test_fullscreen ? surface_flags_fullscreen :
+ surface_flags_window);
+
+ sdl_window = SDL_CreateWindow(program.window_title,
+ SDL_WINDOWPOS_CENTERED,
+ SDL_WINDOWPOS_CENTERED,
+ (int)(scale_factor * video.width),
+ (int)(scale_factor * video.height),
+ surface_flags);
+
+ if (sdl_window != NULL)
+ {
+ sdl_renderer = SDL_CreateRenderer(sdl_window, -1, 0);
+
+ if (sdl_renderer != NULL)
+ {
+ SDL_RenderSetLogicalSize(sdl_renderer, video.width, video.height);
+ SDL_SetHint(SDL_HINT_RENDER_SCALE_QUALITY, "linear");
+
+ sdl_texture = SDL_CreateTexture(sdl_renderer,
+ SDL_PIXELFORMAT_ARGB8888,
+ SDL_TEXTUREACCESS_STREAMING,
+ video.width, video.height);
+
+ if (sdl_texture != NULL)
+ {
+ new_surface = SDL_CreateRGBSurface(0, video.width, video.height, 32,
+ 0x00FF0000,
+ 0x0000FF00,
+ 0x000000FF,
+ 0xFF000000);
+
+ 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
+ sdl_window = SDL_CreateWindow(program.window_title,
+ SDL_WINDOWPOS_CENTERED,
+ SDL_WINDOWPOS_CENTERED,
+ video.width, video.height,
+ surface_flags_window);
+
+ if (sdl_window != NULL)
+ {
+ new_surface = SDL_GetWindowSurface(sdl_window);
+
+ // SDL_UpdateWindowSurface(sdl_window); // immediately map window
+ UpdateScreen(NULL); // immediately map window
+ }
+#endif
+
+#else
+ new_surface = SDL_SetVideoMode(video.width, video.height,
+ video.depth, surface_flags_window);
+#endif
+
+ if (new_surface == NULL)