public interface Component

Known direct subclasses
BoundsComponent

A component that monitors the bounds of an entity and notifies registered listeners of changes.

InteractableComponent

Provides access to raw InputEvents for given Entity, so a client can implement their own interaction logic.

MovableComponent

This Component can be attached to a single instance of an Entity.

PointerCaptureComponent

Provides pointer capture capabilities for a given Entity.

ResizableComponent

This Component can be attached to a single instance of an Entity.

SpatialPointerComponent

Component that modifies the pointer icon that is rendered on the component's Entity.


A Component adds functionality or behaviors to an Entity.

Summary

Public methods

abstract boolean

Called by the framework when this component is being added to an Entity.

abstract void

Called by the framework when this component is being removed from an Entity.

Public methods

onAttach

Added in 1.0.0-alpha14
abstract boolean onAttach(@NonNull Entity entity)

Called by the framework when this component is being added to an Entity.

This method is triggered when Entity.addComponent is invoked. It should not be called directly by applications. Implementations should override this method to perform setup logic or to validate if the component is compatible with the provided entity.

Parameters
@NonNull Entity entity

The Entity to which this component is being attached.

Returns
boolean

true if the component was successfully attached; false if the entity does not support this component or if attachment failed.

onDetach

Added in 1.0.0-alpha14
abstract void onDetach(@NonNull Entity entity)

Called by the framework when this component is being removed from an Entity.

This method is triggered when Entity.removeComponent is invoked. It should not be called directly by applications. Implementations should override this method to release resources or undo any changes made during onAttach.

Parameters
@NonNull Entity entity

The Entity from which this component is being detached.