当前位置: 首页>>代码示例>>Java>>正文


Java KeyEvent.VK_LEFT属性代码示例

本文整理汇总了Java中com.jogamp.newt.event.KeyEvent.VK_LEFT属性的典型用法代码示例。如果您正苦于以下问题:Java KeyEvent.VK_LEFT属性的具体用法?Java KeyEvent.VK_LEFT怎么用?Java KeyEvent.VK_LEFT使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在com.jogamp.newt.event.KeyEvent的用法示例。


在下文中一共展示了KeyEvent.VK_LEFT属性的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: keyPressed

public void keyPressed(KeyEvent e) {
	int keyCode = e.getKeyCode();
	char keyChar = Character.toLowerCase(e.getKeyChar());
	if (keyChar == 'w') keyW = true;
	if (keyChar == 'a') keyA = true;
	if (keyChar == 's') keyS = true;
	if (keyChar == 'd') keyD = true;
	if (keyCode == KeyEvent.VK_LEFT) keyLeft = true;
	if (keyCode == KeyEvent.VK_RIGHT) keyRight = true;
	if (keyCode == KeyEvent.VK_UP) keyUp = true;
}
 
开发者ID:andreasdr,项目名称:tdme,代码行数:11,代码来源:EngineTest.java

示例2: keyReleased

public void keyReleased(KeyEvent e) {
	int keyCode = e.getKeyCode();
	char keyChar = Character.toLowerCase(e.getKeyChar());
	if (keyChar == 'w') keyW = false;
	if (keyChar == 'a') keyA = false;
	if (keyChar == 's') keyS = false;
	if (keyChar == 'd') keyD = false;
	if (keyCode == KeyEvent.VK_LEFT) keyLeft = false;
	if (keyCode == KeyEvent.VK_RIGHT) keyRight = false;
	if (keyCode == KeyEvent.VK_UP) keyUp = false;
}
 
开发者ID:andreasdr,项目名称:tdme,代码行数:11,代码来源:EngineTest.java

示例3: 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;
}
 
开发者ID:andreasdr,项目名称:tdme,代码行数:11,代码来源:PhysicsTest1.java

示例4: 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;
}
 
开发者ID:andreasdr,项目名称:tdme,代码行数:11,代码来源:PhysicsTest1.java

示例5: 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));
}
 
开发者ID:jaamsim,项目名称:jaamsim,代码行数:40,代码来源:DisplayEntity.java

示例6: 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);
    }
}
 
开发者ID:NLeSC,项目名称:Neon,代码行数:12,代码来源:LiveShaderEditorInputHandler.java

示例7: 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;
}
 
开发者ID:NLeSC,项目名称:Neon,代码行数:9,代码来源:TextEditorKeyboardHandler.java

示例8: 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);
}
 
开发者ID:jaamsim,项目名称:jaamsim,代码行数:72,代码来源:CameraControl.java

示例9: 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;
        }
    }
 
开发者ID:java-opengl-labs,项目名称:oit,代码行数:60,代码来源:InputListener.java


注:本文中的com.jogamp.newt.event.KeyEvent.VK_LEFT属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。