Backed out 51935d107921
authorGabriel Jacobo <gabomdq@gmail.com>
Mon, 10 Feb 2014 09:26:22 -0300
changeset 82014a16c26b6055
parent 8200 17b801b31cd5
child 8202 b84a1f55075e
Backed out 51935d107921

The render target usage in controllermap is required if you are forced to use
the app at a different resolution than the one the art has been made for, for
example on Android, where you don't control the resolution.
(The coordinates for each button are hardcoded to the art size, and appear out
of place otherwise)
test/controllermap.c
     1.1 --- a/test/controllermap.c	Mon Feb 10 01:43:01 2014 -0500
     1.2 +++ b/test/controllermap.c	Mon Feb 10 09:26:22 2014 -0300
     1.3 @@ -101,7 +101,7 @@
     1.4  {
     1.5      SDL_Window *window = NULL;
     1.6      SDL_Renderer *screen = NULL;
     1.7 -    SDL_Texture *background, *button, *axis, *marker;
     1.8 +    SDL_Texture *target, *background, *button, *axis, *marker;
     1.9      const char *name = NULL;
    1.10      SDL_bool retval = SDL_FALSE;
    1.11      SDL_bool done = SDL_FALSE, next=SDL_FALSE;
    1.12 @@ -152,6 +152,7 @@
    1.13          return SDL_FALSE;
    1.14      }
    1.15      
    1.16 +    target = SDL_CreateTexture(screen, SDL_PIXELFORMAT_RGB888, SDL_TEXTUREACCESS_TARGET, MAP_WIDTH, MAP_HEIGHT);
    1.17      background = LoadTexture(screen, "controllermap.bmp", SDL_FALSE);
    1.18      button = LoadTexture(screen, "button.bmp", SDL_TRUE);
    1.19      axis = LoadTexture(screen, "axis.bmp", SDL_TRUE);
    1.20 @@ -218,10 +219,13 @@
    1.21                  }
    1.22              }
    1.23              
    1.24 +            SDL_SetRenderTarget(screen, target);
    1.25              SDL_RenderCopy(screen, background, NULL, NULL);
    1.26              SDL_SetTextureAlphaMod(marker, alpha);
    1.27              SDL_SetTextureColorMod(marker, 10, 255, 21);
    1.28              SDL_RenderCopyEx(screen, marker, NULL, &dst, step->angle, NULL, 0);
    1.29 +            SDL_SetRenderTarget(screen, NULL);
    1.30 +            SDL_RenderCopy(screen, target, NULL, NULL);
    1.31              SDL_RenderPresent(screen);
    1.32              
    1.33              if (SDL_PollEvent(&event)) {