sdlxRenderCoordinatesToWindow function render
({double windowX, double windowY})?
sdlxRenderCoordinatesToWindow(
- Pointer<
SdlRenderer> renderer, - double x,
- double y
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.2.0.
\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)
See also:
Implementation
({double windowX, double windowY})? sdlxRenderCoordinatesToWindow(
Pointer<SdlRenderer> renderer,
double x,
double y,
) {
var windowX = 0.0;
var windowY = 0.0;
final windowXPointer = calloc<Float>();
final windowYPointer = calloc<Float>();
final result = sdlRenderCoordinatesToWindow(
renderer,
x,
y,
windowXPointer,
windowYPointer,
);
if (result) {
windowX = windowXPointer.value;
windowY = windowYPointer.value;
}
windowXPointer.callocFree();
windowYPointer.callocFree();
if (!result) {
return null;
}
return (windowX: windowX, windowY: windowY);
}