SpatialPointerComponent


public final class SpatialPointerComponent implements Component


Component that modifies the pointer icon that is rendered on the component's Entity. If this Component is not present on an Entity the default, system-determined icon is used. Removing this Component will set the Entity's pointer back to the default icon.

Summary

Public methods

static final @NonNull SpatialPointerComponent

Creates a new SpatialPointerComponent.

final @NonNull SpatialPointerIcon

The SpatialPointerIcon that will be rendered on the component's Entity when the pointer is located on the entity.

boolean

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

void

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

final void

The SpatialPointerIcon that will be rendered on the component's Entity when the pointer is located on the entity.

Public methods

create

Added in 1.0.0-alpha14
public static final @NonNull SpatialPointerComponent create(@NonNull Session session)

Creates a new SpatialPointerComponent.

Parameters
@NonNull Session session

The Session to use for creating the component.

getSpatialPointerIcon

Added in 1.0.0-alpha14
public final @NonNull SpatialPointerIcon getSpatialPointerIcon()

The SpatialPointerIcon that will be rendered on the component's Entity when the pointer is located on the entity. A SpatialPointerIcon.DEFAULT value indicates the default pointer icon should be used.

onAttach

public 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

public 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.

setSpatialPointerIcon

Added in 1.0.0-alpha14
public final void setSpatialPointerIcon(@NonNull SpatialPointerIcon value)

The SpatialPointerIcon that will be rendered on the component's Entity when the pointer is located on the entity. A SpatialPointerIcon.DEFAULT value indicates the default pointer icon should be used.