SDL_GetDisplayDPI 不适用于 android

SDL_GetDisplayDPI doesn't work on android

我正在尝试通过调用 SDL_GetDisplayDPI 获取显示器的 DPI,但它在我的 Nook Color(使用 CyanogenMod)和 Galaxy S5(使用默认版本 Android). SDL_GetError 表示 "That operaion is not supported"。有没有其他方法可以使用 SDL 找出 DPI?

可以在这个线程中找到答案: https://discourse.libsdl.org/t/an-issue-with-sdl-getdisplaydpi-on-android/23312

“看起来 GetDisplayDPI 目前仅在 Windows、macOS 和 X11 上实现。

稍微看一下 Android 文档,160 * getResources().getDisplayMetrics().density;将根据 UI 比例因子给出 DPI。"