sdlGetDisplayName function

String? sdlGetDisplayName(
  1. int displayId
)

Get the name of a display in UTF-8 encoding.

\param displayID the instance ID of the display to query. \returns the name of a display 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_GetDisplays

extern SDL_DECLSPEC const char * SDLCALL SDL_GetDisplayName(SDL_DisplayID displayID)

Implementation

String? sdlGetDisplayName(int displayId) {
  final sdlGetDisplayNameLookupFunction = libSdl3.lookupFunction<
      Pointer<Utf8> Function(Uint32 displayId),
      Pointer<Utf8> Function(int displayId)>('SDL_GetDisplayName');
  final result = sdlGetDisplayNameLookupFunction(displayId);
  if (result == nullptr) {
    return null;
  }
  return result.toDartString();
}