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 TypeMethodDescriptionfloatReturns the cursor's horizontal position within the window.floatReturns the cursor's vertical position within the window.floatReturns how far the cursor moved horizontally since the previous sample.floatReturns how far the cursor moved vertically since the previous sample.booleanReturns whether the left button is held down.booleanReturns whether the middle button is held down.booleanReturns whether the right button is held down.voidpoll()Samples the mouse, refreshing position, deltas, and button state.window()Returns the window this input reads from.
-
Method Details
-
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:
truewhile the left button is held
-
isRightButtonPressed
boolean isRightButtonPressed()Returns whether the right button is held down.- Returns:
truewhile the right button is held
-
isMiddleButtonPressed
boolean isMiddleButtonPressed()Returns whether the middle button is held down.- Returns:
truewhile the middle button is held
-