sdlxGetTextureSize function render

({double h, double w})? sdlxGetTextureSize(
  1. Pointer<SdlTexture> texture
)

Get the size of a texture, as floating point values.

\param texture the texture to query. \param w a pointer filled in with the width of the texture in pixels. This argument can be NULL if you don't need this information. \param h a pointer filled in with the height of the texture in pixels. This argument can be NULL if you don't need this information. \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.

extern SDL_DECLSPEC bool SDLCALL SDL_GetTextureSize(SDL_Texture *texture, float *w, float *h)

See also:

Implementation

({double w, double h})? sdlxGetTextureSize(Pointer<SdlTexture> texture) {
  var w = 0.0;
  var h = 0.0;
  final wPointer = ffi.calloc<Float>();
  final hPointer = ffi.calloc<Float>();
  final result = sdlGetTextureSize(texture, wPointer, hPointer);
  if (result) {
    w = wPointer.value;
    h = hPointer.value;
  }
  wPointer.callocFree();
  hPointer.callocFree();
  if (!result) {
    return null;
  }
  return (w: w, h: h);
}