Package com.simsilica.lemur.event
Class MouseEventControl
java.lang.Object
com.jme3.scene.control.AbstractControl
com.simsilica.lemur.event.MouseEventControl
- All Implemented Interfaces:
Savable
,Control
,JmeCloneable
,Cloneable
A control that can be added to any Spatial to provide
standard MouseListener/MouseEvent 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())
-
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, MouseListener... listeners) Convenience method that will add a MouseEventControl 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.<T extends MouseListener>
TgetMouseListener
(Class<T> type) boolean
isEmpty()
void
mouseButtonEvent
(MouseButtonEvent event, Spatial target, Spatial capture) void
mouseEntered
(MouseMotionEvent event, Spatial target, Spatial capture) void
mouseExited
(MouseMotionEvent event, Spatial target, Spatial capture) void
mouseMoved
(MouseMotionEvent event, Spatial target, Spatial capture) static void
removeListenersFromSpatial
(Spatial s, MouseListener... listeners) Convenience method that will remove the specified listeners from a Spatial only if a MouseEventControl 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
-
MouseEventControl
public MouseEventControl() -
MouseEventControl
-
-
Method Details
-
addListenersToSpatial
Convenience method that will add a MouseEventControl 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 MouseEventControl already exists. -
getMouseListener
-
isEmpty
public boolean isEmpty() -
addMouseListener
-
removeMouseListener
-
mouseButtonEvent
-
mouseEntered
-
mouseExited
-
mouseMoved
-
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)
-