Java Code Examples for org.lwjgl.input.Mouse#getDY()
The following examples show how to use
org.lwjgl.input.Mouse#getDY() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: Camera.java From LowPolyWater with The Unlicense | 5 votes |
/** * Calculate the pitch and change the pitch if the user is moving the mouse * up or down with the LMB pressed. */ private void calculatePitch() { if (Mouse.isButtonDown(0)) { float pitchChange = Mouse.getDY() * PITCH_SENSITIVITY; pitch.increaseTarget(-pitchChange); clampPitch(); } pitch.update(1f / 60); }
Example 2
Source File: Camera.java From OpenGL-Animation with The Unlicense | 5 votes |
/** * Calculate the pitch and change the pitch if the user is moving the mouse * up or down with the LMB pressed. */ private void calculatePitch() { if (Mouse.isButtonDown(0)) { float pitchChange = Mouse.getDY() * PITCH_SENSITIVITY; pitch.increaseTarget(-pitchChange); clampPitch(); } pitch.update(DisplayManager.getFrameTime()); }
Example 3
Source File: Camera.java From OpenRS with GNU General Public License v3.0 | 5 votes |
public static void acceptInputRotate(float delta) { if(Mouse.isGrabbed()) { float mouseDX = Mouse.getDX(); float mouseDY = -Mouse.getDY(); rotation.y += mouseDX * mouseSensitivity * delta; rotation.x += mouseDY * mouseSensitivity * delta; rotation.x = Math.max(-maxLook, Math.min(maxLook, rotation.x)); } }
Example 4
Source File: Test.java From LWJGL-OpenGL-Tutorials with BSD 3-Clause "New" or "Revised" License | 5 votes |
@Override public void update(long deltaTime) { final float delta = deltaTime / (float)1e9; float turnSpeed = (float)Math.PI * delta; float moveSpeed = (Keyboard.isKeyDown(Keyboard.KEY_LSHIFT) ? 100 : 50) * delta; if(Mouse.isGrabbed()) { angle += turnSpeed * Mouse.getDX() / 20f; angleY -= turnSpeed * Mouse.getDY() / 20f; } if(Keyboard.isKeyDown(Keyboard.KEY_A)) position.add((float)Math.cos(angle + Math.PI) * moveSpeed, 0, (float)Math.sin(angle + Math.PI) * moveSpeed); if(Keyboard.isKeyDown(Keyboard.KEY_D)) position.sub((float)Math.cos(angle + Math.PI) * moveSpeed, 0, (float)Math.sin(angle + Math.PI) * moveSpeed); if(Keyboard.isKeyDown(Keyboard.KEY_W)) position.sub((float)Math.cos(angle + Math.PI / 2) * moveSpeed, 0, (float)Math.sin(angle + Math.PI / 2) * moveSpeed); if(Keyboard.isKeyDown(Keyboard.KEY_S)) position.add((float)Math.cos(angle + Math.PI / 2) * moveSpeed, 0, (float)Math.sin(angle + Math.PI / 2) * moveSpeed); if(Keyboard.isKeyDown(Keyboard.KEY_R)) position.reset(); if(Keyboard.isKeyDown(Keyboard.KEY_SPACE) && position.y() == 0) vy = 30; vy += gravity * delta; position.add(0, vy * delta, 0); if(position.y() < 0) { position.y(0); vy = 0; } }