Package com.jme3.input.lwjgl
Class GlfwMouseInputVR
java.lang.Object
com.jme3.input.lwjgl.GlfwMouseInputVR
- All Implemented Interfaces:
Input
,MouseInput
Captures mouse input using GLFW callbacks. It then temporarily stores these in event queues which are processed in the
This class support modifications dedicated to VR rendering.
update()
method. Due to some of the GLFW button IDs, there is a conversion method in this class which will
convert the GLFW left, middle and right mouse button to JME3 left, middle and right button codes.This class support modifications dedicated to VR rendering.
-
Field Summary
Fields inherited from interface com.jme3.input.MouseInput
AXIS_WHEEL, AXIS_X, AXIS_Y, BUTTON_LEFT, BUTTON_MIDDLE, BUTTON_RIGHT
-
Constructor Summary
ConstructorDescriptionGlfwMouseInputVR
(LwjglWindowVR context) Create a new mouse input attached to the givencontext
. -
Method Summary
Modifier and TypeMethodDescriptionvoid
Clear the last x and y deltas.void
destroy()
Ceases listening to events from the device.int
Returns the number of buttons the mouse has.long
int
Get the last delta in x (pixel).int
Get the last delta in y (pixel).void
Hide the active cursor within the display.void
Initializes the native side to listen into events from the device.boolean
Check if the input is initialized.void
setCursorPosition
(int x, int y) Set the position of the cursor on the display.void
setCursorVisible
(boolean visible) Set whether the mouse cursor should be visible or not.void
setInputListener
(RawInputListener listener) Sets the input listener to receive events from this device.void
setNativeCursor
(JmeCursor jmeCursor) Sets the cursor to use.void
update()
Queries the device for input.
-
Constructor Details
-
GlfwMouseInputVR
Create a new mouse input attached to the givencontext
.- Parameters:
context
- the context to which to attach the input.
-
-
Method Details
-
initialize
public void initialize()Description copied from interface:Input
Initializes the native side to listen into events from the device.- Specified by:
initialize
in interfaceInput
-
setCursorPosition
public void setCursorPosition(int x, int y) Set the position of the cursor on the display.- Parameters:
x
- the x position of the cursor (pixel).y
- the y position of the cursor (pixel).
-
hideActiveCursor
public void hideActiveCursor()Hide the active cursor within the display. -
getLastDeltaX
public int getLastDeltaX()Get the last delta in x (pixel).- Returns:
- the last delta in x (pixel).
- See Also:
-
getLastDeltaY
public int getLastDeltaY()Get the last delta in y (pixel).- Returns:
- the last delta in y (pixel).
- See Also:
-
clearDeltas
public void clearDeltas()Clear the last x and y deltas.- See Also:
-
isInitialized
public boolean isInitialized()Check if the input is initialized.- Specified by:
isInitialized
in interfaceInput
- Returns:
true
if the input is initialized andfalse
otherwise.- See Also:
-
getButtonCount
public int getButtonCount()Description copied from interface:MouseInput
Returns the number of buttons the mouse has. Typically 3 for most mice.- Specified by:
getButtonCount
in interfaceMouseInput
- Returns:
- the number of buttons the mouse has.
-
update
public void update()Description copied from interface:Input
Queries the device for input. All events should be sent to the RawInputListener set with setInputListener. -
destroy
public void destroy()Description copied from interface:Input
Ceases listening to events from the device. -
setCursorVisible
public void setCursorVisible(boolean visible) Description copied from interface:MouseInput
Set whether the mouse cursor should be visible or not.- Specified by:
setCursorVisible
in interfaceMouseInput
- Parameters:
visible
- Whether the mouse cursor should be visible or not.
-
setInputListener
Description copied from interface:Input
Sets the input listener to receive events from this device. The appropriate events should be dispatched through the callbacks in RawInputListener.- Specified by:
setInputListener
in interfaceInput
- Parameters:
listener
- the desired listener
-
getInputTimeNanos
public long getInputTimeNanos()- Specified by:
getInputTimeNanos
in interfaceInput
- Returns:
- The current absolute time as nanoseconds. This time is expected to be relative to the time given in InputEvents time property.
-
setNativeCursor
Description copied from interface:MouseInput
Sets the cursor to use.- Specified by:
setNativeCursor
in interfaceMouseInput
- Parameters:
jmeCursor
- The cursor to use.
-