src/render/SDL_render.c
changeset 5192 ef5a61ea3202
parent 5180 4d098d286794
child 5195 bb45ecd958d8
     1.1 --- a/src/render/SDL_render.c	Sat Feb 05 10:11:27 2011 -0800
     1.2 +++ b/src/render/SDL_render.c	Sat Feb 05 10:35:36 2011 -0800
     1.3 @@ -23,6 +23,7 @@
     1.4  
     1.5  /* The SDL 2D rendering system */
     1.6  
     1.7 +#include "SDL_hints.h"
     1.8  #include "SDL_render.h"
     1.9  #include "SDL_sysrender.h"
    1.10  #include "../video/SDL_pixels_c.h"
    1.11 @@ -94,21 +95,32 @@
    1.12  {
    1.13      SDL_Renderer *renderer = NULL;
    1.14      int n = SDL_GetNumRenderDrivers();
    1.15 +    const char *hint;
    1.16 +
    1.17 +    hint = SDL_GetHint(SDL_HINT_RENDER_VSYNC);
    1.18 +    if (hint) {
    1.19 +        if (*hint == '0') {
    1.20 +            flags &= ~SDL_RENDERER_PRESENTVSYNC;
    1.21 +        } else {
    1.22 +            flags |= SDL_RENDERER_PRESENTVSYNC;
    1.23 +        }
    1.24 +    }
    1.25  
    1.26      if (index < 0) {
    1.27 -        char *override = SDL_getenv("SDL_VIDEO_RENDERER");
    1.28 -
    1.29 -        if (override) {
    1.30 +        hint = SDL_GetHint(SDL_HINT_RENDER_DRIVER);
    1.31 +        if (hint) {
    1.32              for (index = 0; index < n; ++index) {
    1.33                  const SDL_RenderDriver *driver = render_drivers[index];
    1.34  
    1.35 -                if (SDL_strcasecmp(override, driver->info.name) == 0) {
    1.36 +                if (SDL_strcasecmp(hint, driver->info.name) == 0) {
    1.37                      /* Create a new renderer instance */
    1.38                      renderer = driver->CreateRenderer(window, flags);
    1.39                      break;
    1.40                  }
    1.41              }
    1.42 -        } else {
    1.43 +        }
    1.44 +
    1.45 +        if (!renderer) {
    1.46              for (index = 0; index < n; ++index) {
    1.47                  const SDL_RenderDriver *driver = render_drivers[index];
    1.48