[SDL] Android: SDL_CreateWindow always aligns the game to the left of the device screen

Gabriele Greco gabriele.greco at darts.it
Fri Mar 15 06:48:58 PDT 2013

> If the screen set with "SCREEN_WIDTH" and "SCREEN_HEIGHT" is smaller than
> the device screen, SDL_CreateWindow always puts the game screen aligned to
> the left. It should be aligned to the middle. This is a problem since most
> games aim from 4/3 format to 16/9 while most device screens are in that
> format but since the android bar is always on the remaining resolution
> aspect ratio is sometimes wider and thus the game has to be letterboxed a
> little.
> Hoe can I patch it? Or fix this

SDL_WINDOWPOS_CENTERED is for... windows.

You are using a fullscreen display, so it does not apply, you can anyway
achieve what you need rendering to a surface (with SDL_SetRenderTarget for
instance) and then blitting your surface to the desired position/aspect

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.libsdl.org/pipermail/sdl-libsdl.org/attachments/20130315/6203df63/attachment-0009.htm>

More information about the SDL mailing list