Basics

Guides

API Reference

Menu

Basics

Guides

API Reference

class: NotificationService

[18:7] extends: EngineService

Wraps FXGL's NotificationService, the engine service that displays toast-style messages over the active scene. Reached at runtime via fxgl.getNotificationService (chunk 6); obtain a wrapper via adopt. The default implementation queues notifications, shows each one for three seconds with a one-second slide-in / slide-out animation, and supports configurable background and text colors.

Methods

  • NotificationService (Ajo = null)

    Creates a NotificationService wrapper. Empty by default (populated later via adopt); the (Ajo) form wraps an existing instance from fxgl.getNotificationService.

    • @p Ajo is an optional AussomJavaObject around a NotificationService.
  • adopt (object Ajo)

    Wraps an existing NotificationService AussomJavaObject.

    • @p Ajo is an AussomJavaObject around a NotificationService.
    • @r A new wrapper.
  • pushNotification (string Message)

    Pushes a notification with the given message text.

    • @p Message is the notification text.
    • @r this object
  • pushNotificationWithIcon (string Message, object IconObj)

    Pushes a notification with both message and a leading icon Node.

    • @p Message is the notification text.
    • @p IconObj is a Node wrapper for the icon.
    • @r this object
  • setBackgroundColor (object ColorObj)

    Sets the notification background color.

    • @p ColorObj is a Color wrapper.
    • @r this object
  • setTextColor (object ColorObj)

    Sets the notification text color.

    • @p ColorObj is a Color wrapper.
    • @r this object
  • getBackgroundColor ()

    Returns the current notification background color.

    • @r An AussomJavaObject around a Color.
  • getTextColor ()

    Returns the current notification text color.

    • @r An AussomJavaObject around a Color.