sdlRenderCoordinatesFromWindow function render

bool sdlRenderCoordinatesFromWindow(
  1. Pointer<SdlRenderer> renderer,
  2. double windowX,
  3. double windowY,
  4. Pointer<Float> x,
  5. Pointer<Float> y,
)

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 sdlRenderCoordinatesFromWindow(
  Pointer<SdlRenderer> renderer,
  double windowX,
  double windowY,
  Pointer<Float> x,
  Pointer<Float> y,
) {
  final sdlRenderCoordinatesFromWindowLookupFunction = _libSdl
      .lookupFunction<
        Uint8 Function(
          Pointer<SdlRenderer> renderer,
          Float windowX,
          Float windowY,
          Pointer<Float> x,
          Pointer<Float> y,
        ),
        int Function(
          Pointer<SdlRenderer> renderer,
          double windowX,
          double windowY,
          Pointer<Float> x,
          Pointer<Float> y,
        )
      >('SDL_RenderCoordinatesFromWindow');
  return sdlRenderCoordinatesFromWindowLookupFunction(
        renderer,
        windowX,
        windowY,
        x,
        y,
      ) ==
      1;
}