József Szigeti
József Szigeti

Reputation: 41

iOS Retina display with SDL2

I am using SDL2, and have now a little problem with it on iOS with iPhone 5S. When I create a window, SDL will creates a window with 320x568 pixel resolution. If I use the SDL_WINDOW_ALLOW_HDPI flag by creating window, I can draw each pixels of the display (640x1136), but if I get the screen size with the SDL_GetWindowSize function I get the 320x568 px resolution back.

I tried to get the available display modes, but a display mode with 640x1136 px I have not found.

What am I doing wrong?

Upvotes: 1

Views: 1238

Answers (1)

tx2
tx2

Reputation: 734

If you see on SDL_GetWindowSize method description this gives you the window size, but if you use SDL_WINDOW_ALLOW_HDPI this may differ from real size.

The window size in screen coordinates may differ from the size in pixels, if the window was created with SDL_WINDOW_ALLOW_HIGHDPI on a platform with high-dpi support (e.g. iOS or OS X).

To get the real window size in pixels you can either use SDL_GL_GetDrawableSize() or SDL_GetRendererOutputSize().

Upvotes: 2

Related Questions