src/core/winrt/SDL_winrtapp_common.h
author Sam Lantinga <slouken@libsdl.org>
Sun, 08 Dec 2019 11:36:40 -0800
changeset 13321 37350f1e7902
parent 12503 806492103856
permissions -rw-r--r--
Fixed bug 4883 - Add approximation for display DPI on iOS

Aaron Barany

There appears to be no way to directly access the display DPI on iOS, so as an approximation the DPI for the iPhone 1 is used as a base value and is multiplied by the screen's scale. This should at least give a ballpark number for the various screen scales. (based on https://stackoverflow.com/questions/25756087/detecting-iphone-6-6-screen-sizes-in-point-values it appears that both 2x and 3x are used)

I have updated the patch to use a table of current devices and use a computation as a fallback. I have also updated the fallback computation to be more accurate.
     1 /*
     2   Simple DirectMedia Layer
     3   Copyright (C) 1997-2019 Sam Lantinga <slouken@libsdl.org>
     4 
     5   This software is provided 'as-is', without any express or implied
     6   warranty.  In no event will the authors be held liable for any damages
     7   arising from the use of this software.
     8 
     9   Permission is granted to anyone to use this software for any purpose,
    10   including commercial applications, and to alter it and redistribute it
    11   freely, subject to the following restrictions:
    12 
    13   1. The origin of this software must not be misrepresented; you must not
    14      claim that you wrote the original software. If you use this software
    15      in a product, an acknowledgment in the product documentation would be
    16      appreciated but is not required.
    17   2. Altered source versions must be plainly marked as such, and must not be
    18      misrepresented as being the original software.
    19   3. This notice may not be removed or altered from any source distribution.
    20 */
    21 #include "SDL_config.h"
    22 
    23 #ifndef SDL_winrtapp_common_h_
    24 #define SDL_winrtapp_common_h_
    25 
    26 /* A pointer to the app's C-style main() function (which is a different
    27    function than the WinRT app's actual entry point).
    28  */
    29 extern int (*WINRT_SDLAppEntryPoint)(int, char **);
    30 
    31 #endif // SDL_winrtapp_common_h_