Java Code Examples for com.jogamp.newt.event.KeyEvent#getKeyCode()
The following examples show how to use
com.jogamp.newt.event.KeyEvent#getKeyCode() .
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: HelloTriangle.java From CPE552-Java with GNU General Public License v3.0 | 5 votes |
@Override public void keyPressed(KeyEvent e) { if (e.getKeyCode() == KeyEvent.VK_ESCAPE) { new Thread(() -> { window.destroy(); }).start(); } }
Example 2
Source File: HelloGlobe.java From CPE552-Java with GNU General Public License v3.0 | 5 votes |
@Override public void keyPressed(KeyEvent e) { if (e.getKeyCode() == KeyEvent.VK_ESCAPE) { new Thread(() -> { window.destroy(); }).start(); } }
Example 3
Source File: HelloTriangle.java From hello-triangle with MIT License | 5 votes |
@Override public void keyPressed(KeyEvent e) { if (e.getKeyCode() == KeyEvent.VK_ESCAPE) { new Thread(() -> { window.destroy(); }).start(); } }
Example 4
Source File: HelloGlobe.java From hello-triangle with MIT License | 5 votes |
@Override public void keyPressed(KeyEvent e) { if (e.getKeyCode() == KeyEvent.VK_ESCAPE) { new Thread(() -> { window.destroy(); }).start(); } }
Example 5
Source File: HelloTriangle.java From hello-triangle with MIT License | 5 votes |
@Override public void keyPressed(KeyEvent e) { if (e.getKeyCode() == KeyEvent.VK_ESCAPE) { new Thread(() -> { window.destroy(); }).start(); } }
Example 6
Source File: HelloTexture.java From hello-triangle with MIT License | 5 votes |
@Override public void keyPressed(KeyEvent e) { if (e.getKeyCode() == KeyEvent.VK_ESCAPE) { new Thread(() -> { window.destroy(); }).start(); } }
Example 7
Source File: HelloTriangleSimple.java From hello-triangle with MIT License | 5 votes |
@Override public void keyPressed(KeyEvent e) { if (e.getKeyCode() == KeyEvent.VK_ESCAPE) { new Thread(() -> { window.destroy(); }).start(); } }
Example 8
Source File: KeyboardControl.java From clearvolume with GNU Lesser General Public License v3.0 | 5 votes |
private void processSingleKeyToggableEvents(KeyEvent pE, final Collection<?> lOverlays) { boolean lHasAnyOverlayBeenToggled = false; for (final Object lOverlay : lOverlays) if (lOverlay instanceof SingleKeyToggable) { final SingleKeyToggable lSingleKeyToggable = (SingleKeyToggable) lOverlay; final boolean lRightKey = pE.getKeyCode() == lSingleKeyToggable.toggleKeyCode(); final boolean lRightModifiers = pE.getModifiers() == lSingleKeyToggable.toggleKeyModifierMask(); // (pE.getModifiers() & // lSingleKeyToggable.toggleKeyModifierMask()) == // lSingleKeyToggable.toggleKeyModifierMask(); if (lRightKey && lRightModifiers) { lSingleKeyToggable.toggle(); lHasAnyOverlayBeenToggled = true; } } if (lHasAnyOverlayBeenToggled) mClearVolumeRenderer.notifyChangeOfVolumeRenderingParameters(); }
Example 9
Source File: Test.java From jogl-samples with MIT License | 5 votes |
@Override public void keyReleased(KeyEvent e) { switch (e.getKeyCode()) { case KeyEvent.VK_ESCAPE: animator.stop(); glWindow.destroy(); break; } }
Example 10
Source File: CameraControl.java From jaamsim with Apache License 2.0 | 4 votes |
@Override public void keyPressed(KeyEvent e) { // If an entity has been selected, pass the key event to it boolean bool = RenderManager.inst().handleKeyPressed(e.getKeyCode(), e.getKeyChar(), e.isShiftDown(), e.isControlDown(), e.isAltDown()); if (bool) return; // If no entity has been selected, the camera will handle the key event Vec3d pos = _updateView.getGlobalPosition(); Vec3d cent = _updateView.getGlobalCenter(); // Construct a unit vector in the x-y plane in the direction of the view center Vec3d forward = new Vec3d(cent); forward.sub3(pos); forward.z = 0.0d; forward.normalize3(); // Trap the degenerate case where the camera look straight down on the x-y plane // For this case the normalize3 method returns a unit vector in the z-direction if (forward.z > 0.0) forward.set3(0.0d, 1.0d, 0.0d); // Construct a unit vector pointing to the left of the direction vector Vec3d left = new Vec3d( -forward.y, forward.x, 0.0d); // Scale the two vectors to the desired step size double inc = GUIFrame.getJaamSimModel().getSimulation().getIncrementSize(); forward.scale3(inc); left.scale3(inc); int keyCode = e.getKeyCode(); if (keyCode == KeyEvent.VK_LEFT || keyCode == KeyEvent.VK_A) { pos.add3(left); cent.add3(left); } else if (keyCode == KeyEvent.VK_RIGHT || keyCode == KeyEvent.VK_D) { pos.sub3(left); cent.sub3(left); } else if (keyCode == KeyEvent.VK_UP || keyCode == KeyEvent.VK_W) { if (e.isShiftDown()) { pos.set3(pos.x, pos.y, pos.z+inc); cent.set3(cent.x, cent.y, cent.z+inc); } else { pos.add3(forward); cent.add3(forward); } } else if (keyCode == KeyEvent.VK_DOWN || keyCode == KeyEvent.VK_S) { if (e.isShiftDown()) { pos.set3(pos.x, pos.y, pos.z-inc); cent.set3(cent.x, cent.y, cent.z-inc); } else { pos.sub3(forward); cent.sub3(forward); } } else return; _updateView.updateCenterAndPos(cent, pos); }