PointerCaptureComponent
public final class PointerCaptureComponent implements Component
Provides pointer capture capabilities for a given Entity.
To enable pointer capture, the task must be in full space, the entity must be visible, and the PointerCaptureComponent must be attached to the entity.
Only one PointerCaptureComponent can be attached to an entity at a given time. If a second one tries to attach to an entity, it will fail.
Summary
Nested types |
|---|
public final class PointerCaptureComponent.PointerCaptureStateDefines the possible states of a |
Public methods |
|
|---|---|
static final @NonNull PointerCaptureComponent |
create(Creates a new instance of |
boolean |
Called by an |
void |
Called by an |
Public methods
create
public static final @NonNull PointerCaptureComponent create(
@NonNull Session session,
@NonNull Executor executor,
@NonNull Consumer<@NonNull PointerCaptureComponent.PointerCaptureState> stateListener,
@NonNull Consumer<@NonNull InputEvent> inputListener
)
Creates a new instance of PointerCaptureComponent.
| Parameters | |
|---|---|
@NonNull Session session |
The active |
@NonNull Executor executor |
The |
@NonNull Consumer<@NonNull PointerCaptureComponent.PointerCaptureState> stateListener |
A |
@NonNull Consumer<@NonNull InputEvent> inputListener |
A |
| Returns | |
|---|---|
@NonNull PointerCaptureComponent |
A new instance of |
onAttach
public boolean onAttach(@NonNull Entity entity)
Called by an Entity when it attempts to add this Component to itself.
This method is restricted because it is only called from Entity.addComponent.
| Returns | |
|---|---|
boolean |
True if the Component was attached to the given Entity. False if the Entity did not support having this Component attached. |
onDetach
public void onDetach(@NonNull Entity entity)
Called by an Entity when it attempts to detach this Component from itself.
This method is restricted because it is only called from Entity.removeComponent.