Interface RenderModuleMouseInput

All Known Implementing Classes:
GLFWRenderModuleMouseInput

public interface RenderModuleMouseInput
Mouse state for one window, independent of the windowing library providing it.

As with the keyboard, state is sampled rather than delivered: poll() captures the mouse once per frame and the query methods answer against that snapshot. The deltas are the movement since the previous sample, which is what a camera wants, rather than absolute motion.

  • Method Summary

    Modifier and Type
    Method
    Description
    float
    Returns the cursor's horizontal position within the window.
    float
    Returns the cursor's vertical position within the window.
    float
    Returns how far the cursor moved horizontally since the previous sample.
    float
    Returns how far the cursor moved vertically since the previous sample.
    boolean
    Returns whether the left button is held down.
    boolean
    Returns whether the middle button is held down.
    boolean
    Returns whether the right button is held down.
    void
    Samples the mouse, refreshing position, deltas, and button state.
    Returns the window this input reads from.
  • Method Details

    • window

      Returns the window this input reads from.
      Returns:
      the owning window
    • poll

      void poll()
      Samples the mouse, refreshing position, deltas, and button state.

      Called once per frame by the owning window.

    • getCurrentX

      float getCurrentX()
      Returns the cursor's horizontal position within the window.
      Returns:
      the current x coordinate in pixels from the left edge
    • getCurrentY

      float getCurrentY()
      Returns the cursor's vertical position within the window.
      Returns:
      the current y coordinate in pixels from the top edge
    • getDeltaX

      float getDeltaX()
      Returns how far the cursor moved horizontally since the previous sample.
      Returns:
      the change in x since the last poll(), in pixels
    • getDeltaY

      float getDeltaY()
      Returns how far the cursor moved vertically since the previous sample.
      Returns:
      the change in y since the last poll(), in pixels
    • isLeftButtonPressed

      boolean isLeftButtonPressed()
      Returns whether the left button is held down.
      Returns:
      true while the left button is held
    • isRightButtonPressed

      boolean isRightButtonPressed()
      Returns whether the right button is held down.
      Returns:
      true while the right button is held
    • isMiddleButtonPressed

      boolean isMiddleButtonPressed()
      Returns whether the middle button is held down.
      Returns:
      true while the middle button is held