sdlGetMouseNameForId function

String? sdlGetMouseNameForId(
  1. int instanceId
)

Get the name of a mouse.

This function returns "" if the mouse doesn't have a name.

\param instance_id the mouse instance ID. \returns the name of the selected mouse, or NULL 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_GetMice

extern SDL_DECLSPEC const char * SDLCALL SDL_GetMouseNameForID(SDL_MouseID instance_id)

Implementation

String? sdlGetMouseNameForId(int instanceId) {
  final sdlGetMouseNameForIdLookupFunction = libSdl3.lookupFunction<
      Pointer<Utf8> Function(Uint32 instanceId),
      Pointer<Utf8> Function(int instanceId)>('SDL_GetMouseNameForID');
  final result = sdlGetMouseNameForIdLookupFunction(instanceId);
  if (result == nullptr) {
    return null;
  }
  return result.toDartString();
}