本文整理汇总了Java中com.jogamp.newt.event.KeyEvent.VK_DOWN属性的典型用法代码示例。如果您正苦于以下问题:Java KeyEvent.VK_DOWN属性的具体用法?Java KeyEvent.VK_DOWN怎么用?Java KeyEvent.VK_DOWN使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类com.jogamp.newt.event.KeyEvent
的用法示例。
在下文中一共展示了KeyEvent.VK_DOWN属性的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: keyPressed
public void keyPressed(KeyEvent e) {
int keyCode = e.getKeyCode();
if (keyCode == KeyEvent.VK_LEFT) keyLeft = true;
if (keyCode == KeyEvent.VK_RIGHT) keyRight = true;
if (keyCode == KeyEvent.VK_UP) keyUp = true;
if (keyCode == KeyEvent.VK_DOWN) keyDown = true;
if (keyCode == KeyEvent.VK_A) keyA = true;
if (keyCode == KeyEvent.VK_D) keyD = true;
if (keyCode == KeyEvent.VK_W) keyW = true;
if (keyCode == KeyEvent.VK_S) keyS = true;
}
示例2: keyReleased
public void keyReleased(KeyEvent e) {
int keyCode = e.getKeyCode();
if (keyCode == KeyEvent.VK_LEFT) keyLeft = false;
if (keyCode == KeyEvent.VK_RIGHT) keyRight = false;
if (keyCode == KeyEvent.VK_UP) keyUp = false;
if (keyCode == KeyEvent.VK_DOWN) keyDown = false;
if (keyCode == KeyEvent.VK_A) keyA = false;
if (keyCode == KeyEvent.VK_D) keyD = false;
if (keyCode == KeyEvent.VK_W) keyW = false;
if (keyCode == KeyEvent.VK_S) keyS = false;
}
示例3: handleKeyPressed
public void handleKeyPressed(int keyCode, char keyChar, boolean shift, boolean control, boolean alt) {
if (!isMovable())
return;
Vec3d pos = getPosition();
double inc = Simulation.getIncrementSize();
if (Simulation.isSnapToGrid())
inc = Math.max(inc, Simulation.getSnapGridSpacing());
switch (keyCode) {
case KeyEvent.VK_LEFT:
pos.x -= inc;
break;
case KeyEvent.VK_RIGHT:
pos.x +=inc;
break;
case KeyEvent.VK_UP:
if (shift)
pos.z += inc;
else
pos.y += inc;
break;
case KeyEvent.VK_DOWN:
if (shift)
pos.z -= inc;
else
pos.y -= inc;
break;
default:
return;
}
if (Simulation.isSnapToGrid())
pos = Simulation.getSnapGridPosition(pos, pos, shift);
KeywordIndex kw = InputAgent.formatPointInputs(positionInput.getKeyword(), pos, "m");
InputAgent.storeAndExecute(new KeywordCommand(this, kw));
}
示例4: keyPressed
@Override
public void keyPressed(KeyEvent e) {
super.keyPressed(e);
if (e.getKeyCode() != KeyEvent.VK_UP && e.getKeyCode() != KeyEvent.VK_DOWN
&& e.getKeyCode() != KeyEvent.VK_LEFT && e.getKeyCode() != KeyEvent.VK_RIGHT
&& e.getKeyCode() != KeyEvent.VK_PAGE_UP && e.getKeyCode() != KeyEvent.VK_PAGE_DOWN
&& e.getKeyCode() != KeyEvent.VK_END && e.getKeyCode() != KeyEvent.VK_HOME) {
setReCompileNeeded(true);
}
}
示例5: isMovementKey
public boolean isMovementKey(KeyEvent e) {
int code = e.getKeyCode();
if (code == KeyEvent.VK_UP || code == KeyEvent.VK_DOWN || code == KeyEvent.VK_LEFT || code == KeyEvent.VK_RIGHT
|| code == KeyEvent.VK_PAGE_UP || code == KeyEvent.VK_PAGE_DOWN || code == KeyEvent.VK_HOME
|| code == KeyEvent.VK_END) {
return true;
}
return false;
}
示例6: keyPressed
@Override
public void keyPressed(KeyEvent e) {
// If an entity has been selected, pass the key event to it
if (RenderManager.inst().isEntitySelected()) {
RenderManager.inst().handleKeyPressed(e.getKeyCode(), e.getKeyChar(),
e.isShiftDown(), e.isControlDown(), e.isAltDown());
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(1.0d, 0.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 = Simulation.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);
}