Added the concept of display natural orientation

Also renamed SDL_GetDisplayOrientation() SDL_GetDisplayCurrentOrientation()

The natural orientation of the primary display is the frame of reference for accelerometer and gyro sensor readings.
This commit is contained in:
Sam Lantinga
2023-06-17 00:52:40 -07:00
parent 8de6ce7e92
commit e6d1ba2a17
20 changed files with 213 additions and 79 deletions

View File

@@ -466,6 +466,7 @@
/* ##SDL_video.h */
#define SDL_GetClosestDisplayMode SDL_GetClosestFullscreenDisplayMode
#define SDL_GetDisplayOrientation SDL_GetDisplayCurrentOrientation
#define SDL_GetPointDisplayIndex SDL_GetDisplayForPoint
#define SDL_GetRectDisplayIndex SDL_GetDisplayForRect
#define SDL_GetWindowDisplayIndex SDL_GetDisplayForWindow
@@ -902,6 +903,7 @@
/* ##SDL_video.h */
#define SDL_GetClosestDisplayMode SDL_GetClosestDisplayMode_renamed_SDL_GetClosestFullscreenDisplayMode
#define SDL_GetDisplayOrientation SDL_GetDisplayOrientation_renamed_SDL_GetDisplayCurrentOrientation
#define SDL_GetPointDisplayIndex SDL_GetPointDisplayIndex_renamed_SDL_GetDisplayForPoint
#define SDL_GetRectDisplayIndex SDL_GetRectDisplayIndex_renamed_SDL_GetDisplayForRect
#define SDL_GetWindowDisplayIndex SDL_GetWindowDisplayIndex_renamed_SDL_GetDisplayForWindow

View File

@@ -96,7 +96,7 @@ typedef enum
*
* The axis data is not changed when the device is rotated.
*
* \sa SDL_GetDisplayOrientation()
* \sa SDL_GetDisplayCurrentOrientation()
*/
#define SDL_STANDARD_GRAVITY 9.80665f
@@ -120,7 +120,7 @@ typedef enum
*
* The axis data is not changed when the device is rotated.
*
* \sa SDL_GetDisplayOrientation()
* \sa SDL_GetDisplayCurrentOrientation()
*/
/* Function prototypes */

View File

@@ -394,6 +394,19 @@ 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 orientation of a display when it is unrotated.
*
* \param displayID the instance ID of the display to query
* \returns The SDL_DisplayOrientation enum value of the display, or
* `SDL_ORIENTATION_UNKNOWN` if it isn't available.
*
* \since This function is available since SDL 3.0.0.
*
* \sa SDL_GetDisplays
*/
extern DECLSPEC SDL_DisplayOrientation SDLCALL SDL_GetDisplayNaturalOrientation(SDL_DisplayID displayID);
/**
* Get the orientation of a display.
*
@@ -405,7 +418,7 @@ extern DECLSPEC int SDLCALL SDL_GetDisplayUsableBounds(SDL_DisplayID displayID,
*
* \sa SDL_GetDisplays
*/
extern DECLSPEC SDL_DisplayOrientation SDLCALL SDL_GetDisplayOrientation(SDL_DisplayID displayID);
extern DECLSPEC SDL_DisplayOrientation SDLCALL SDL_GetDisplayCurrentOrientation(SDL_DisplayID displayID);
/**
* Get the content scale of a display.