Class CursorEventControl

java.lang.Object
com.jme3.scene.control.AbstractControl
com.simsilica.lemur.event.CursorEventControl
All Implemented Interfaces:
Savable, Control, JmeCloneable, Cloneable

public class CursorEventControl extends AbstractControl
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.
  • Constructor Details

    • CursorEventControl

      public CursorEventControl()
    • CursorEventControl

      public CursorEventControl(CursorListener... listeners)
  • Method Details

    • addListenersToSpatial

      public static void addListenersToSpatial(Spatial s, CursorListener... listeners)
      Convenience method that will add a CursorEventControl if it doesn't exist, while adding the specified listeners.
    • removeListenersFromSpatial

      public static void removeListenersFromSpatial(Spatial s, CursorListener... listeners)
      Convenience method that will remove the specified listeners from a Spatial only if a CursorEventControl already exists.
    • getMouseListener

      public <T extends CursorListener> T getMouseListener(Class<T> type)
    • isEmpty

      public boolean isEmpty()
    • addMouseListener

      public void addMouseListener(CursorListener l)
    • removeMouseListener

      public void removeMouseListener(CursorListener l)
    • cursorButtonEvent

      public void cursorButtonEvent(CursorButtonEvent event, Spatial target, Spatial capture)
    • cursorEntered

      public void cursorEntered(CursorMotionEvent event, Spatial target, Spatial capture)
    • cursorExited

      public void cursorExited(CursorMotionEvent event, Spatial target, Spatial capture)
    • cursorMoved

      public void cursorMoved(CursorMotionEvent event, Spatial target, Spatial capture)
    • controlRender

      protected void controlRender(RenderManager rm, ViewPort vp)
      Description copied from class: AbstractControl
      To be implemented in subclass.
      Specified by:
      controlRender in class AbstractControl
      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 class AbstractControl
      Parameters:
      tpf - time per frame (in seconds)