Basics

Guides

API Reference

Menu

Basics

Guides

API Reference

class: ComponentLifecycle

[36:14] static extends: object

Documentation helper for FXGL's three component-lifecycle interfaces:

  • com.almasb.fxgl.entity.component.ComponentListener two-method interface (onAdded, onRemoved). Subscribe with Entity.addComponentListener.
  • com.almasb.fxgl.entity.component.CopyableComponent<T> single-method copy(): T marker for Entity.copy.
  • com.almasb.fxgl.entity.component.SerializableComponent two-method interface (write(Bundle), read(Bundle)) for Component-level save/load. The single-method CopyableComponent can be supplied from Aussom via the standard aji.closure pattern: copy = aji.closure( "com.almasb.fxgl.entity.component.CopyableComponent", myCopyCb); The two-method ComponentListener and SerializableComponent interfaces need full Java bridge subclasses to author from Aussom (similar to AussomComponent / AussomCollisionHandler). Those bridges are pending — file a follow-up if your game needs them. Custom Java types that already implement these interfaces can be passed as raw AJOs without a bridge.

Methods

  • componentListenerName ()

    Returns the fully qualified Java interface name for ComponentListener, suitable as the first arg to aji.closure for single-method-style usage even though the interface has two methods (use a Java bridge for proper support).

  • copyableComponentName ()

    Returns the fully qualified Java interface name for CopyableComponent.

  • serializableComponentName ()

    Returns the fully qualified Java interface name for SerializableComponent.