Package com.simsilica.lemur.event
Class CursorEventControl
java.lang.Object
com.jme3.scene.control.AbstractControl
com.simsilica.lemur.event.CursorEventControl
- All Implemented Interfaces:
Savable
,Control
,JmeCloneable
,Cloneable
A control that can be added to any Spatial to provide
standard CursorListener/CursorEvent support. The only requirement
is that the Spatial must be somewhere in a hierarchy that has
been provided to the MouseAppState or GuiGlobals class and that
MouseAppState is active (either manually attached to the StateManager
or done automatically by GuiGlobals.initialize()) or is otherwise
a part of a PickEventSession.
-
Field Summary
Fields inherited from class com.jme3.scene.control.AbstractControl
enabled, spatial
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic void
addListenersToSpatial
(Spatial s, CursorListener... listeners) Convenience method that will add a CursorEventControl if it doesn't exist, while adding the specified listeners.void
protected void
controlRender
(RenderManager rm, ViewPort vp) To be implemented in subclass.protected void
controlUpdate
(float tpf) To be implemented in subclass.void
cursorButtonEvent
(CursorButtonEvent event, Spatial target, Spatial capture) void
cursorEntered
(CursorMotionEvent event, Spatial target, Spatial capture) void
cursorExited
(CursorMotionEvent event, Spatial target, Spatial capture) void
cursorMoved
(CursorMotionEvent event, Spatial target, Spatial capture) <T extends CursorListener>
TgetMouseListener
(Class<T> type) boolean
isEmpty()
static void
removeListenersFromSpatial
(Spatial s, CursorListener... listeners) Convenience method that will remove the specified listeners from a Spatial only if a CursorEventControl already exists.void
Methods inherited from class com.jme3.scene.control.AbstractControl
cloneFields, cloneForSpatial, getSpatial, isEnabled, jmeClone, read, render, setEnabled, setSpatial, update, write
-
Constructor Details
-
Method Details
-
addListenersToSpatial
Convenience method that will add a CursorEventControl if it doesn't exist, while adding the specified listeners. -
removeListenersFromSpatial
Convenience method that will remove the specified listeners from a Spatial only if a CursorEventControl already exists. -
getMouseListener
-
isEmpty
public boolean isEmpty() -
addMouseListener
-
removeMouseListener
-
cursorButtonEvent
-
cursorEntered
-
cursorExited
-
cursorMoved
-
controlRender
Description copied from class:AbstractControl
To be implemented in subclass.- Specified by:
controlRender
in classAbstractControl
- Parameters:
rm
- the RenderManager rendering the controlled Spatial (not null)vp
- the ViewPort being rendered (not null)
-
controlUpdate
protected void controlUpdate(float tpf) Description copied from class:AbstractControl
To be implemented in subclass.- Specified by:
controlUpdate
in classAbstractControl
- Parameters:
tpf
- time per frame (in seconds)
-