Renderer logical size is now implemented as a render target
This fixes rounding errors with coordinate scaling and gives more flexibility in the presentation, as well as making it easy to maintain device independent resolution as windows move between different pixel density displays. By default when a renderer is created, it will match the window size so window coordinates and render coordinates are 1-1. Mouse and touch events are no longer filtered to change their coordinates, instead you can call SDL_ConvertEventToRenderCoordinates() to explicitly map event coordinates into the rendering viewport. SDL_RenderWindowToLogical() and SDL_RenderLogicalToWindow() have been renamed SDL_RenderCoordinatesFromWindow() and SDL_RenderCoordinatesToWindow() and take floating point coordinates in both directions. The viewport, clipping state, and scale for render targets are now persistent and will remain set whenever they are active.
This commit is contained in:
@@ -631,10 +631,10 @@ extern DECLSPEC Uint32 SDLCALL SDL_GetWindowPixelFormat(SDL_Window *window);
|
||||
* The window size in pixels may differ from its size in screen coordinates if
|
||||
* the window is on a high density display (one with an OS scaling factor).
|
||||
* Use SDL_GetWindowSize() to query the client area's size in screen
|
||||
* coordinates, and SDL_GetWindowSizeInPixels() or SDL_GetRendererOutputSize()
|
||||
* coordinates, and SDL_GetWindowSizeInPixels() or SDL_GetRenderOutputSize()
|
||||
* to query the drawable size in pixels. Note that the drawable size can vary
|
||||
* after the window is created and should be queried again when the window is
|
||||
* resized or moved between displays.
|
||||
* after the window is created and should be queried again if you get an
|
||||
* SDL_EVENT_WINDOW_PIXEL_SIZE_CHANGED event.
|
||||
*
|
||||
* If the window is set fullscreen, the width and height parameters `w` and
|
||||
* `h` will not be used. However, invalid size parameters (e.g. too large) may
|
||||
@@ -868,7 +868,7 @@ extern DECLSPEC void SDLCALL SDL_SetWindowSize(SDL_Window *window, int w, int h)
|
||||
*
|
||||
* The window size in screen coordinates may differ from the size in pixels if
|
||||
* the window is on a high density display (one with an OS scaling factor).
|
||||
* Use SDL_GetWindowSizeInPixels() or SDL_GetRendererOutputSize() to get the
|
||||
* Use SDL_GetWindowSizeInPixels() or SDL_GetRenderOutputSize() to get the
|
||||
* real client area size in pixels.
|
||||
*
|
||||
* \param window the window to query the width and height from
|
||||
@@ -877,8 +877,8 @@ extern DECLSPEC void SDLCALL SDL_SetWindowSize(SDL_Window *window, int w, int h)
|
||||
*
|
||||
* \since This function is available since SDL 3.0.0.
|
||||
*
|
||||
* \sa SDL_GetRenderOutputSize
|
||||
* \sa SDL_GetWindowSizeInPixels
|
||||
* \sa SDL_GetRendererOutputSize
|
||||
* \sa SDL_SetWindowSize
|
||||
*/
|
||||
extern DECLSPEC void SDLCALL SDL_GetWindowSize(SDL_Window *window, int *w, int *h);
|
||||
|
||||
Reference in New Issue
Block a user