Make controllermap, etc, work on platforms with hardcoded window sizes.

This makes sure everything renders correctly, even if, say, an Android device
gives you a certain "window" size no matter what you ask for.
This commit is contained in:
Ryan C. Gordon 2014-02-10 11:29:48 -05:00
parent fddd6a295f
commit f4f293ae2a
2 changed files with 12 additions and 7 deletions

View file

@ -170,6 +170,9 @@ WatchGameController(SDL_GameController * gamecontroller)
SDL_RenderPresent(screen);
SDL_RaiseWindow(window);
/* scale for platforms that don't give you the window size you asked for. */
SDL_RenderSetLogicalSize(screen, SCREEN_WIDTH, SCREEN_HEIGHT);
background = LoadTexture(screen, "controllermap.bmp", SDL_FALSE);
button = LoadTexture(screen, "button.bmp", SDL_TRUE);
axis = LoadTexture(screen, "axis.bmp", SDL_TRUE);
@ -191,7 +194,7 @@ WatchGameController(SDL_GameController * gamecontroller)
/* Loop, getting controller events! */
while (!done) {
/* blank screen, set up for drawing this frame. */
SDL_SetRenderDrawColor(screen, 0x00, 0x00, 0x00, SDL_ALPHA_OPAQUE);
SDL_SetRenderDrawColor(screen, 0xFF, 0xFF, 0xFF, SDL_ALPHA_OPAQUE);
SDL_RenderClear(screen);
SDL_RenderCopy(screen, background, NULL, NULL);