sdlRenderCoordinatesToWindow function
Get a point in window coordinates when given a point in render 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 x the x coordinate in render coordinates. \param y the y coordinate in render coordinates. \param window_x a pointer filled with the x coordinate in window coordinates. \param window_y a pointer filled with the y coordinate in window 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.1.3.
\sa SDL_SetRenderLogicalPresentation \sa SDL_SetRenderScale \sa SDL_SetRenderViewport
extern SDL_DECLSPEC bool SDLCALL SDL_RenderCoordinatesToWindow(SDL_Renderer *renderer, float x, float y, float *window_x, float *window_y)
Implementation
bool sdlRenderCoordinatesToWindow(Pointer<SdlRenderer> renderer, double x,
double y, Pointer<Float> windowX, Pointer<Float> windowY) {
final sdlRenderCoordinatesToWindowLookupFunction = libSdl3.lookupFunction<
Uint8 Function(Pointer<SdlRenderer> renderer, Float x, Float y,
Pointer<Float> windowX, Pointer<Float> windowY),
int Function(
Pointer<SdlRenderer> renderer,
double x,
double y,
Pointer<Float> windowX,
Pointer<Float> windowY)>('SDL_RenderCoordinatesToWindow');
return sdlRenderCoordinatesToWindowLookupFunction(
renderer, x, y, windowX, windowY) ==
1;
}