coordinatesFromWindow method

bool coordinatesFromWindow({
  1. required SdlxFPoint windowPosition,
  2. required SdlxFPoint renderPosition,
})

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)

Implementation

bool coordinatesFromWindow({
  required SdlxFPoint windowPosition,
  required SdlxFPoint renderPosition,
}) => sdlxRenderCoordinatesFromWindow(
  this,
  windowPosition: windowPosition,
  renderPosition: renderPosition,
);