本文整理汇总了Java中com.jogamp.newt.event.KeyEvent.VK_S属性的典型用法代码示例。如果您正苦于以下问题:Java KeyEvent.VK_S属性的具体用法?Java KeyEvent.VK_S怎么用?Java KeyEvent.VK_S使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类com.jogamp.newt.event.KeyEvent
的用法示例。
在下文中一共展示了KeyEvent.VK_S属性的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: keyPressed
@Override
public void keyPressed(KeyEvent ke) {
float step = 0.05f;
switch(ke.getKeyCode()){
case KeyEvent.VK_A:
float ambientIntensity = Tutorial17.instance.getDirectionalLight().getAmbientIntensity();
ambientIntensity += step;
Tutorial17.instance.getDirectionalLight().setAmbientIntensity(ambientIntensity);
break;
case KeyEvent.VK_S:
ambientIntensity = Tutorial17.instance.getDirectionalLight().getAmbientIntensity();
ambientIntensity -= step;
Tutorial17.instance.getDirectionalLight().setAmbientIntensity(ambientIntensity);
break;
}
}
示例2: 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;
}
示例3: 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;
}
示例4: keyPressed
@Override
public void keyPressed(KeyEvent ke) {
float step = 0.05f;
switch (ke.getKeyCode()) {
case KeyEvent.VK_A:
float ambientIntensity = Tutorial22.instance.getDirectionalLight().ambientIntensity;
ambientIntensity += step;
Tutorial22.instance.getDirectionalLight().ambientIntensity = ambientIntensity;
break;
case KeyEvent.VK_S:
ambientIntensity = Tutorial22.instance.getDirectionalLight().ambientIntensity;
ambientIntensity -= step;
Tutorial22.instance.getDirectionalLight().ambientIntensity = ambientIntensity;
break;
case KeyEvent.VK_Z:
float diffuseIntensity = Tutorial22.instance.getDirectionalLight().diffuseIntensity;
diffuseIntensity += step;
Tutorial22.instance.getDirectionalLight().diffuseIntensity = diffuseIntensity;
break;
case KeyEvent.VK_X:
diffuseIntensity = Tutorial22.instance.getDirectionalLight().diffuseIntensity;
diffuseIntensity -= step;
Tutorial22.instance.getDirectionalLight().diffuseIntensity = diffuseIntensity;
break;
}
}
示例5: keyPressed
@Override
public void keyPressed(KeyEvent ke) {
float step = 0.05f;
switch (ke.getKeyCode()) {
case KeyEvent.VK_A:
float ambientIntensity = Tutorial19.instance.getDirectionalLight().getAmbientIntensity();
ambientIntensity += step;
Tutorial19.instance.getDirectionalLight().setAmbientIntensity(ambientIntensity);
break;
case KeyEvent.VK_S:
ambientIntensity = Tutorial19.instance.getDirectionalLight().getAmbientIntensity();
ambientIntensity -= step;
Tutorial19.instance.getDirectionalLight().setAmbientIntensity(ambientIntensity);
break;
case KeyEvent.VK_Z:
float diffuseIntensity = Tutorial19.instance.getDirectionalLight().getDiffuseIntensity();
diffuseIntensity += step;
Tutorial19.instance.getDirectionalLight().setDiffuseIntensity(diffuseIntensity);
break;
case KeyEvent.VK_X:
diffuseIntensity = Tutorial19.instance.getDirectionalLight().getDiffuseIntensity();
diffuseIntensity -= step;
Tutorial19.instance.getDirectionalLight().setDiffuseIntensity(diffuseIntensity);
break;
}
}
示例6: keyPressed
@Override
public void keyPressed(KeyEvent ke) {
float step = 0.05f;
switch (ke.getKeyCode()) {
case KeyEvent.VK_A:
float ambientIntensity = Tutorial20.instance.getDirectionalLight().ambientIntensity;
ambientIntensity += step;
Tutorial20.instance.getDirectionalLight().ambientIntensity = ambientIntensity;
break;
case KeyEvent.VK_S:
ambientIntensity = Tutorial20.instance.getDirectionalLight().ambientIntensity;
ambientIntensity -= step;
Tutorial20.instance.getDirectionalLight().ambientIntensity = ambientIntensity;
break;
case KeyEvent.VK_Z:
float diffuseIntensity = Tutorial20.instance.getDirectionalLight().diffuseIntensity;
diffuseIntensity += step;
Tutorial20.instance.getDirectionalLight().diffuseIntensity = diffuseIntensity;
break;
case KeyEvent.VK_X:
diffuseIntensity = Tutorial20.instance.getDirectionalLight().diffuseIntensity;
diffuseIntensity -= step;
Tutorial20.instance.getDirectionalLight().diffuseIntensity = diffuseIntensity;
break;
}
}
示例7: keyPressed
@Override
public void keyPressed(KeyEvent ke) {
float step = 0.05f;
switch(ke.getKeyCode()){
case KeyEvent.VK_A:
float ambientIntensity = Tutorial18.instance.getDirectionalLight().getAmbientIntensity();
ambientIntensity += step;
Tutorial18.instance.getDirectionalLight().setAmbientIntensity(ambientIntensity);
break;
case KeyEvent.VK_S:
ambientIntensity = Tutorial18.instance.getDirectionalLight().getAmbientIntensity();
ambientIntensity -= step;
Tutorial18.instance.getDirectionalLight().setAmbientIntensity(ambientIntensity);
break;
case KeyEvent.VK_Z:
float diffuseIntensity = Tutorial18.instance.getDirectionalLight().getDiffuseIntensity();
diffuseIntensity += step;
Tutorial18.instance.getDirectionalLight().setDiffuseIntensity(diffuseIntensity);
break;
case KeyEvent.VK_X:
diffuseIntensity = Tutorial18.instance.getDirectionalLight().getDiffuseIntensity();
diffuseIntensity -= step;
Tutorial18.instance.getDirectionalLight().setDiffuseIntensity(diffuseIntensity);
break;
}
}
示例8: keyPressed
@Override
public void keyPressed(KeyEvent ke) {
float step = 0.05f;
switch (ke.getKeyCode()) {
case KeyEvent.VK_A:
float ambientIntensity = Tutorial21.instance.getDirectionalLight().ambientIntensity;
ambientIntensity += step;
Tutorial21.instance.getDirectionalLight().ambientIntensity = ambientIntensity;
break;
case KeyEvent.VK_S:
ambientIntensity = Tutorial21.instance.getDirectionalLight().ambientIntensity;
ambientIntensity -= step;
Tutorial21.instance.getDirectionalLight().ambientIntensity = ambientIntensity;
break;
case KeyEvent.VK_Z:
float diffuseIntensity = Tutorial21.instance.getDirectionalLight().diffuseIntensity;
diffuseIntensity += step;
Tutorial21.instance.getDirectionalLight().diffuseIntensity = diffuseIntensity;
break;
case KeyEvent.VK_X:
diffuseIntensity = Tutorial21.instance.getDirectionalLight().diffuseIntensity;
diffuseIntensity -= step;
Tutorial21.instance.getDirectionalLight().diffuseIntensity = diffuseIntensity;
break;
}
}
示例9: 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);
}
示例10: InputHandler
/**
* Initializes the inputs and sets up a {@code Robot} that controls the mouse.
* @param c
*/
public InputHandler(Controller c) {
this.c = c;
GLWindow win = c.getWindow();
try {
robot = new Robot();
} catch (AWTException e) {
throw new RuntimeException("The program will not function properly with the current permissions");
}
win.addKeyListener(this);
win.addMouseListener(this);
focused = false;
mouseSensitivity = 1.0/45/200;
//Initialize keys
keyCode = new int[NUM_KEYS];
keyCode[0] = KeyEvent.VK_W;
keyCode[1] = KeyEvent.VK_S;
keyCode[2] = KeyEvent.VK_A;
keyCode[3] = KeyEvent.VK_D;
keyCode[4] = KeyEvent.VK_SHIFT;
keyCode[5] = KeyEvent.VK_Q;
keyCode[6] = KeyEvent.VK_E;
keyCode[7] = KeyEvent.VK_1;
keyCode[8] = KeyEvent.VK_2;
keyCode[9] = KeyEvent.VK_3;
keyCode[10] = KeyEvent.VK_4;
keyCode[11] = KeyEvent.VK_V;
keyCode[12] = KeyEvent.VK_SPACE;
keyCode[13] = KeyEvent.VK_R;
keyCode[14] = KeyEvent.VK_DELETE;
keyCode[15] = KeyEvent.VK_EQUALS;
keyCode[16] = KeyEvent.VK_MINUS;
keyCode[17] = KeyEvent.VK_P;
keyCode[18] = KeyEvent.VK_O;
keyCode[19] = KeyEvent.VK_5;
keyCode[20] = KeyEvent.VK_6;
keyCode[21] = KeyEvent.VK_CONTROL;
keyCode[22] = KeyEvent.VK_F1;
keyCode[23] = KeyEvent.VK_F2;
mouseButton = new int[NUM_MOUSE_BUTTONS];
mouseButton[0] = MouseEvent.BUTTON1;
mouseButton[1] = MouseEvent.BUTTON3;
//Initialize key and mouse control variables.
keyDown = new boolean[NUM_KEYS];
keyCanceled = new boolean[NUM_KEYS];
keyPressed = new boolean[NUM_KEYS];
keyHelper = new boolean[NUM_KEYS];
mouseDown = new boolean[NUM_MOUSE_BUTTONS];
mouseCanceled = new boolean[NUM_MOUSE_BUTTONS];
mousePressed = new boolean[NUM_MOUSE_BUTTONS];
mouseHelper = new boolean[NUM_MOUSE_BUTTONS];
for (int i=0; i<NUM_KEYS; i++) {
keyDown[i] = false;
keyCanceled[i] = false;
keyPressed[i] = false;
keyHelper[i] = false;
}
for (int i=0; i<NUM_MOUSE_BUTTONS; i++) {
mouseDown[i] = false;
mouseCanceled[i] = false;
mousePressed[i] = false;
mouseHelper[i] = false;
}
}
示例11: charPress
public void charPress(KeyEvent keyEvent) {
float offset = keyEvent.isShiftDown() ? viewScale.smallPosOffset() : viewScale.largePosOffset();
if (rightKeyboardCtrls) {
switch (keyEvent.getKeyCode()) {
case KeyEvent.VK_I:
offsetTargetPos(TargetOffsetDir.FORWARD, offset);
break;
case KeyEvent.VK_K:
offsetTargetPos(TargetOffsetDir.BACKWARD, offset);
break;
case KeyEvent.VK_L:
offsetTargetPos(TargetOffsetDir.RIGHT, offset);
break;
case KeyEvent.VK_J:
offsetTargetPos(TargetOffsetDir.LEFT, offset);
break;
case KeyEvent.VK_O:
offsetTargetPos(TargetOffsetDir.UP, offset);
break;
case KeyEvent.VK_U:
offsetTargetPos(TargetOffsetDir.DOWN, offset);
break;
}
} else {
switch (keyEvent.getKeyCode()) {
case KeyEvent.VK_W:
offsetTargetPos(TargetOffsetDir.FORWARD, offset);
break;
case KeyEvent.VK_S:
offsetTargetPos(TargetOffsetDir.BACKWARD, offset);
break;
case KeyEvent.VK_D:
offsetTargetPos(TargetOffsetDir.RIGHT, offset);
break;
case KeyEvent.VK_A:
offsetTargetPos(TargetOffsetDir.LEFT, offset);
break;
case KeyEvent.VK_E:
offsetTargetPos(TargetOffsetDir.UP, offset);
break;
case KeyEvent.VK_Q:
offsetTargetPos(TargetOffsetDir.DOWN, offset);
break;
}
}
}
示例12: keyReleased
@Override
public void keyReleased(KeyEvent e) {
switch (e.getKeyCode()) {
case KeyEvent.VK_Q:
Resources.useOQ = !Resources.useOQ;
break;
case KeyEvent.VK_RIGHT:
Resources.numPasses++;
Resources.numLayers = (Resources.numPasses - 1) * 2;
break;
case KeyEvent.VK_LEFT:
Resources.numPasses--;
Resources.numPasses = Math.max(Resources.numPasses, 1);
Resources.numLayers = (Resources.numPasses - 1) * 2;
break;
case KeyEvent.VK_B:
Resources.backgroundColor = (Resources.backgroundColor.x == Resources.white.x)
? Resources.black : Resources.white;
break;
case KeyEvent.VK_O:
// Viewer.showOsd = !Viewer.showOsd;
break;
case KeyEvent.VK_1:
Viewer.newOit = Viewer.Oit.DUAL_DEPTH_PEELING;
break;
case KeyEvent.VK_2:
Viewer.newOit = Viewer.Oit.DEPTH_PEELING;
break;
case KeyEvent.VK_3:
Viewer.newOit = Viewer.Oit.WEIGHTED_AVERAGE;
break;
case KeyEvent.VK_4:
Viewer.newOit = Viewer.Oit.WEIGHTED_SUM;
break;
case KeyEvent.VK_5:
Viewer.newOit = Viewer.Oit.WEIGHTED_BLENDED;
break;
case KeyEvent.VK_A:
Resources.opacity -= 0.05f;
Resources.opacity = (float) Math.max(Resources.opacity, 0.0);
break;
case KeyEvent.VK_D:
Resources.opacity += 0.05f;
Resources.opacity = (float) Math.min(Resources.opacity, 1.0);
break;
case KeyEvent.VK_W:
Resources.weight -= 0.05f;
Resources.weight = (float) Math.max(Resources.weight, 0.0);
break;
case KeyEvent.VK_S:
Resources.weight += 0.05f;
Resources.weight = (float) Math.min(Resources.weight, 1.0);
break;
case KeyEvent.VK_ESCAPE:
Resources.animator.stop();
break;
}
}