Class Mouse

java.lang.Object
buildengine.engine.input.Mouse
All Implemented Interfaces:
MouseListener, MouseMotionListener, MouseWheelListener, EventListener

public class Mouse extends Object implements MouseListener, MouseMotionListener, MouseWheelListener
All mouse movement and click handling.
See Also:
  • Constructor Details

    • Mouse

      public Mouse()
  • Method Details

    • init

      public void init()
      Initialisation
    • pollEvents

      public void pollEvents()
      Updates after input circle
    • reset

      public void reset()
      Resets all values
    • mousePressed

      public void mousePressed(MouseEvent e)
      Specified by:
      mousePressed in interface MouseListener
    • isClicked

      public boolean isClicked(int key, ClickType type)
      Checks if a key is currently being clicked in any form.
      Parameters:
      key - The keycode of the key that's possibly being clicked.
      type - The type of the click. For example ClickType.HOLD
      Returns:
      If the key is being pressed or not.
    • isHold

      public boolean isHold(int button)
    • isClicked

      public boolean isClicked(int button)
    • isReleased

      public boolean isReleased(int button)
    • getPosition

      public Vector2i getPosition()
      Returns:
      the current mouse position (pixels)
    • getMouseWheelRotation

      public int getMouseWheelRotation()
      Gets the rotation of the mouse wheel. Each rotation "flick" returns another value.
      Returns:
      -1 when turning away from the user, 1 when turning towards and 0 if there is no rotation.
    • mouseReleased

      public void mouseReleased(MouseEvent e)
      Specified by:
      mouseReleased in interface MouseListener
    • mouseMoved

      public void mouseMoved(MouseEvent e)
      Specified by:
      mouseMoved in interface MouseMotionListener
    • mouseDragged

      public void mouseDragged(MouseEvent e)
      Specified by:
      mouseDragged in interface MouseMotionListener
    • mouseClicked

      public void mouseClicked(MouseEvent e)
      Specified by:
      mouseClicked in interface MouseListener
    • mouseEntered

      public void mouseEntered(MouseEvent e)
      Specified by:
      mouseEntered in interface MouseListener
    • mouseExited

      public void mouseExited(MouseEvent e)
      Specified by:
      mouseExited in interface MouseListener
    • mouseWheelMoved

      public void mouseWheelMoved(MouseWheelEvent e)
      Specified by:
      mouseWheelMoved in interface MouseWheelListener