mirror of
https://github.com/libsdl-org/SDL.git
synced 2025-12-26 08:09:11 +00:00
Removed SDL_GetDisplayDPI()
This function wasn't consistently correct across platforms and devices. If you want the UI scale factor, you can use display_scale in the structure returned by SDL_GetDesktopDisplayMode(). If you need an approximate DPI, you can multiply this value times 160 on iPhone and Android, and 96 on other platforms.
This commit is contained in:
@@ -425,7 +425,6 @@
|
||||
|
||||
/* ##SDL_video.h */
|
||||
#define SDL_GetClosestDisplayMode SDL_GetClosestFullscreenDisplayMode
|
||||
#define SDL_GetDisplayDPI SDL_GetDisplayPhysicalDPI
|
||||
#define SDL_GetPointDisplayIndex SDL_GetDisplayForPoint
|
||||
#define SDL_GetRectDisplayIndex SDL_GetDisplayForRect
|
||||
#define SDL_GetWindowDisplayIndex SDL_GetDisplayForWindow
|
||||
@@ -822,7 +821,6 @@
|
||||
|
||||
/* ##SDL_video.h */
|
||||
#define SDL_GetClosestDisplayMode SDL_GetClosestDisplayMode_renamed_SDL_GetClosestFullscreenDisplayMode
|
||||
#define SDL_GetDisplayDPI SDL_GetDisplayDPI_renamed_SDL_GetDisplayPhysicalDPI
|
||||
#define SDL_GetPointDisplayIndex SDL_GetPointDisplayIndex_renamed_SDL_GetDisplayForPoint
|
||||
#define SDL_GetRectDisplayIndex SDL_GetRectDisplayIndex_renamed_SDL_GetDisplayForRect
|
||||
#define SDL_GetWindowDisplayIndex SDL_GetWindowDisplayIndex_renamed_SDL_GetDisplayForWindow
|
||||
|
||||
@@ -375,36 +375,6 @@ extern DECLSPEC int SDLCALL SDL_GetDisplayBounds(SDL_DisplayID displayID, SDL_Re
|
||||
*/
|
||||
extern DECLSPEC int SDLCALL SDL_GetDisplayUsableBounds(SDL_DisplayID displayID, SDL_Rect *rect);
|
||||
|
||||
/**
|
||||
* Get the dots/pixels-per-inch for a display.
|
||||
*
|
||||
* Diagonal, horizontal and vertical DPI can all be optionally returned if the
|
||||
* appropriate parameter is non-NULL.
|
||||
*
|
||||
* **WARNING**: This reports the DPI that the hardware reports, and it is not
|
||||
* always reliable! It is almost always better to use SDL_GetWindowSize() to
|
||||
* find the window size, which might be in logical points instead of pixels,
|
||||
* and then SDL_GetWindowSizeInPixels() or SDL_GetRendererOutputSize(), and
|
||||
* compare the two values to get an actual scaling value between the two. We
|
||||
* will be rethinking how high-dpi details should be managed in SDL3 to make
|
||||
* things more consistent, reliable, and clear.
|
||||
*
|
||||
* \param displayID the instance ID of the display to query
|
||||
* \param ddpi a pointer filled in with the diagonal DPI of the display; may
|
||||
* be NULL
|
||||
* \param hdpi a pointer filled in with the horizontal DPI of the display; may
|
||||
* be NULL
|
||||
* \param vdpi a pointer filled in with the vertical DPI of the display; may
|
||||
* be NULL
|
||||
* \returns 0 on success or a negative error code on failure; call
|
||||
* SDL_GetError() for more information.
|
||||
*
|
||||
* \since This function is available since SDL 3.0.0.
|
||||
*
|
||||
* \sa SDL_GetDisplays
|
||||
*/
|
||||
extern DECLSPEC int SDLCALL SDL_GetDisplayPhysicalDPI(SDL_DisplayID displayID, float *ddpi, float *hdpi, float *vdpi);
|
||||
|
||||
/**
|
||||
* Get the orientation of a display.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user