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 voidaddListenersToSpatial(Spatial s, CursorListener... listeners) Convenience method that will add a CursorEventControl if it doesn't exist, while adding the specified listeners.voidprotected voidcontrolRender(RenderManager rm, ViewPort vp) To be implemented in subclass.protected voidcontrolUpdate(float tpf) To be implemented in subclass.voidcursorButtonEvent(CursorButtonEvent event, Spatial target, Spatial capture) voidcursorEntered(CursorMotionEvent event, Spatial target, Spatial capture) voidcursorExited(CursorMotionEvent event, Spatial target, Spatial capture) voidcursorMoved(CursorMotionEvent event, Spatial target, Spatial capture) <T extends CursorListener>
TgetMouseListener(Class<T> type) booleanisEmpty()static voidremoveListenersFromSpatial(Spatial s, CursorListener... listeners) Convenience method that will remove the specified listeners from a Spatial only if a CursorEventControl already exists.voidMethods inherited from class com.jme3.scene.control.AbstractControl
cloneFields, cloneForSpatial, getSpatial, isEnabled, jmeClone, read, render, setEnabled, setSpatial, update, write
-
Constructor Details
-
CursorEventControl
public CursorEventControl() -
CursorEventControl
-
-
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:AbstractControlTo be implemented in subclass.- Specified by:
controlRenderin 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:AbstractControlTo be implemented in subclass.- Specified by:
controlUpdatein classAbstractControl- Parameters:
tpf- time per frame (in seconds)
-