coordinatesFromWindow method

({double x, double y})? coordinatesFromWindow(
  1. double windowX,
  2. double windowY
)

Get a point in render coordinates when given a point in window coordinates.

This takes into account several states:

  • The window dimensions.
  • The logical presentation settings (SDL_SetRenderLogicalPresentation)
  • The scale (SDL_SetRenderScale)
  • The viewport (SDL_SetRenderViewport)

\param renderer the rendering context. \param window_x the x coordinate in window coordinates. \param window_y the y coordinate in window coordinates. \param x a pointer filled with the x coordinate in render coordinates. \param y a pointer filled with the y coordinate in render coordinates. \returns true on success or false on failure; call SDL_GetError() for more information.

\threadsafety This function should only be called on the main thread.

\since This function is available since SDL 3.2.0.

\sa SDL_SetRenderLogicalPresentation \sa SDL_SetRenderScale

extern SDL_DECLSPEC bool SDLCALL SDL_RenderCoordinatesFromWindow(SDL_Renderer *renderer, float window_x, float window_y, float *x, float *y)

See also:

Implementation

({double x, double y})? coordinatesFromWindow(
  double windowX,
  double windowY,
) => sdlxRenderCoordinatesFromWindow(this, windowX, windowY);