sdlShowNotification function notification

int sdlShowNotification(
  1. String? title,
  2. String? message,
  3. Pointer<SdlSurface> image,
  4. Pointer<SdlNotificationAction> actions,
  5. int numActions,
)

Show a system notification with normal priority.

\param title UTF-8 title text, required. \param message UTF-8 message text, may be NULL. \param image The image associated with this notification, may be NULL. \param actions An array of actions to attach to the notification, may be NULL. \param num_actions The number of actions in the actions array. \returns A non-zero SDL_NotificationID on success or 0 on failure; call SDL_GetError() for more information.

\since This function is available since SDL 3.6.0.

\sa SDL_ShowNotificationWithProperties \sa SDL_NotificationAction \sa SDL_NotificationEvent

extern SDL_DECLSPEC SDL_NotificationID SDLCALL SDL_ShowNotification(const char *title, const char *message, SDL_Surface *image, SDL_NotificationAction *actions, int num_actions)

Implementation

int sdlShowNotification(
  String? title,
  String? message,
  Pointer<SdlSurface> image,
  Pointer<SdlNotificationAction> actions,
  int numActions,
) {
  final sdlShowNotificationLookupFunction = _libSdl
      .lookupFunction<
        Uint32 Function(
          Pointer<Utf8> title,
          Pointer<Utf8> message,
          Pointer<SdlSurface> image,
          Pointer<SdlNotificationAction> actions,
          Int32 numActions,
        ),
        int Function(
          Pointer<Utf8> title,
          Pointer<Utf8> message,
          Pointer<SdlSurface> image,
          Pointer<SdlNotificationAction> actions,
          int numActions,
        )
      >('SDL_ShowNotification');
  final titlePointer = title != null ? title.toNativeUtf8() : nullptr;
  final messagePointer = message != null ? message.toNativeUtf8() : nullptr;
  final result = sdlShowNotificationLookupFunction(
    titlePointer,
    messagePointer,
    image,
    actions,
    numActions,
  );
  calloc
    ..free(titlePointer)
    ..free(messagePointer);
  return result;
}