sdlConvertEventToRenderCoordinates function
Convert the coordinates in an event to 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)
Touch coordinates are converted from normalized coordinates in the window to non-normalized rendering coordinates.
Once converted, the coordinates may be outside the rendering area.
\param renderer the rendering context. \param event the event to modify. \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_RenderCoordinatesFromWindow
extern SDL_DECLSPEC bool SDLCALL SDL_ConvertEventToRenderCoordinates(SDL_Renderer *renderer, SDL_Event *event)
Implementation
bool sdlConvertEventToRenderCoordinates(
Pointer<SdlRenderer> renderer, Pointer<SdlEvent> event) {
final sdlConvertEventToRenderCoordinatesLookupFunction =
libSdl3.lookupFunction<
Uint8 Function(
Pointer<SdlRenderer> renderer, Pointer<SdlEvent> event),
int Function(Pointer<SdlRenderer> renderer,
Pointer<SdlEvent> event)>('SDL_ConvertEventToRenderCoordinates');
return sdlConvertEventToRenderCoordinatesLookupFunction(renderer, event) == 1;
}