Class GLFWRenderModuleMouseInput

java.lang.Object
io.codetoil.curved_spacetime.render.glfw.GLFWRenderModuleMouseInput
All Implemented Interfaces:
RenderModuleMouseInput

public class GLFWRenderModuleMouseInput extends Object implements RenderModuleMouseInput
Mouse input backed by GLFW.

Position and button state arrive through GLFW callbacks; the deltas are computed in poll() by differencing against the previous frame's position. Movement is only accumulated while the cursor is inside the window, so re-entering does not produce a large spurious delta from wherever the cursor left.

  • Field Details

    • window

      protected final GLFWRenderModuleWindow window
      The window this input reads from.
    • currentX

      protected float currentX
      The cursor's current x position, or -1.0f before the first movement.
    • currentY

      protected float currentY
      The cursor's current y position, or -1.0f before the first movement.
    • deltaX

      protected float deltaX
      Horizontal movement since the previous poll().
    • deltaY

      protected float deltaY
      Vertical movement since the previous poll().
    • previousX

      protected float previousX
      The cursor's x position at the previous poll().
    • previousY

      protected float previousY
      The cursor's y position at the previous poll().
    • inWindow

      protected boolean inWindow
      Whether the cursor is currently inside the window.
    • leftButtonPressed

      protected boolean leftButtonPressed
      Whether the left button is held.
    • rightButtonPressed

      protected boolean rightButtonPressed
      Whether the right button is held.
    • middleButtonPressed

      protected boolean middleButtonPressed
      Whether the middle button is held.
  • Constructor Details

    • GLFWRenderModuleMouseInput

      public GLFWRenderModuleMouseInput(GLFWRenderModuleWindow window)
      Attaches mouse handling to the given window.

      Installs GLFW cursor position, cursor enter, and mouse button callbacks, replacing any previously set on that window.

      Parameters:
      window - the window to read mouse input from
  • Method Details