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 Link icon

    • CursorEventControl Link icon

      public CursorEventControl()
    • CursorEventControl Link icon

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

    • addListenersToSpatial Link icon

      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 Link icon

      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 Link icon

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

      public boolean isEmpty()
    • addMouseListener Link icon

      public void addMouseListener(CursorListener l)
    • removeMouseListener Link icon

      public void removeMouseListener(CursorListener l)
    • cursorButtonEvent Link icon

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

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

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

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

      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 Link icon

      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)