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


Java Keys.ENTER属性代码示例

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


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

示例1: keyDown

@Override
public boolean keyDown(int keycode) {
	
	if (keycode == Keys.UP) {
		upPressed = true;
	} else if (keycode == Keys.LEFT) {
		leftPressed = true;
	} else if (keycode == Keys.DOWN) {
		downPressed = true;
	} else if (keycode == Keys.RIGHT) {
		rightPressed = true;
	}
	
	if (keycode == Keys.E) {
		firePressed = true;
	} else if (keycode == Keys.W) {
		shieldPressed = true;
	}
	
	if (keycode == Keys.ENTER) {
		startJustPressed = true;
	}

	return false;
}
 
开发者ID:libgdx-examples,项目名称:space-arcade,代码行数:25,代码来源:InputHandler.java

示例2: keyDown

@Override
public boolean keyDown(int optionIndex, int keyOrButtonCode) {
	switch (optionIndex) {
		case OPTION_LANGUAGE: {
			if (Keys.LEFT == keyOrButtonCode) {
				--currentLocale;
				if (currentLocale < 0) {
					currentLocale = availableLocales.length - 1;
				}
			} else if (Keys.RIGHT == keyOrButtonCode) {
				++currentLocale;
				currentLocale %= availableLocales.length;
			} else if (Keys.ENTER == keyOrButtonCode) {
				//return true in this case to not start the selection missile
				return true;
			}

			GameUtils.setCfgPreferenceValue(GameConstants.PREFERENCE_KEY_LANGUAGE, availableLocales[currentLocale]);
			options.get(OPTION_INFO).setText(GameUtils.getLocalizedLabel("MainMenu.option.settings.language." + availableLocales[currentLocale]));
			break;
		}
	}

	return false;
}
 
开发者ID:Quillraven,项目名称:Protoman-vs-Megaman,代码行数:25,代码来源:LanguageMenuPage.java

示例3: onInitUI

@Override
protected void onInitUI() {
	Skin skin = GdxUISkin.instance().getDeafult();
	input = new TextField("", skin);
	
	ClickListener mClickListener = new ClickListener() {
		public boolean keyDown (InputEvent event, int keycode) {
			if(keycode == Keys.ENTER && !isHide()) {
				if(!handleCmdString(input.getText())) {
					//clear input 
					input.setText(null);
				}
			}
			return true;
		}
	};
	input.addCaptureListener(mClickListener);
	
	input.setTextFieldFilter(new TextFieldFilter() {
		@Override
		public boolean acceptChar(TextField textField, char c) {
			if(c == '`' || c == '~') {
				hide();
				return false;
			}
			return true;
		}
	});
	label = new Label("", skin);
	
	maxTmp = GdxUIConfig.instance().consoleMaxOutputLine;
	
	input.setSize(getUIWidth()/2, 32);
	input.setPosition(20, getUIHeight() * 0.25f);
	addUI(input);
	addUI(label);
	
	skin = null;
}
 
开发者ID:mingwuyun,项目名称:cocos2d-java,代码行数:39,代码来源:GdxUIConsole.java

示例4: keyUp

@Override
public boolean keyUp(int keycode) {
    if (keycode == Input.Keys.R) {
        init();
        Gdx.app.debug(TAG, "Game world resetted");
    }

    else if (keycode == Keys.ENTER) {
        cameraHelper.setTarget(cameraHelper.hasTarget() ? null : level.bunnyHead);
        Gdx.app.debug(TAG,
                "Camera follow enabled: " + cameraHelper.hasTarget());
    }
    return false;
}
 
开发者ID:davyjoneswang,项目名称:libgdx-learnlib,代码行数:14,代码来源:WorldController.java

示例5: keyUp

@Override
public boolean keyUp (int keycode) {
	if (keycode == Keys.ENTER) {
		toggleDebugMode();
		return true;
	}
	return super.keyUp(keycode);
}
 
开发者ID:Matsemann,项目名称:eamaster,代码行数:8,代码来源:BaseBulletTest.java

示例6: setDisplayKeyID

@Override
public void setDisplayKeyID (int code) {
	if (code == Keys.ENTER) {
		return;
	}
	keyID = code;
}
 
开发者ID:StrongJoshua,项目名称:libgdx-inGameConsole,代码行数:7,代码来源:GUIConsole.java

示例7: keyUp

public boolean keyUp(int k) {
	if(mode==0){
		if(k == Keys.W || k == Keys.UP) MyInput.setKey(Input.UP, false);
		if(k == Keys.A || k == Keys.LEFT) MyInput.setKey(Input.LEFT, false);
		if(k == Keys.S || k == Keys.DOWN) MyInput.setKey(Input.DOWN, false);
		if(k == Keys.D || k == Keys.RIGHT) MyInput.setKey(Input.RIGHT, false);
		if(k == Keys.SPACE) MyInput.setKey(Input.JUMP, false);
		if(k == Keys.Q || k == Keys.CONTROL_RIGHT) MyInput.setKey(Input.INTERACT, false);
		if(k == Keys.E || k == Keys.NUMPAD_0) MyInput.setKey(Input.ATTACK, false);
		if(k == Keys.SHIFT_LEFT) MyInput.setKey(Input.SPECIAL, false);
		if(k == Keys.CONTROL_LEFT || k == Keys.Z) MyInput.setKey(Input.RUN, false);
		if(k == Keys.R || k == Keys.NUMPAD_1) MyInput.setKey(Input.USE, false);
		if(k == Keys.ESCAPE) MyInput.setKey(Input.PAUSE, false);
		if(k == Keys.ENTER) MyInput.setKey(Input.ENTER, false);
		if(k == Keys.TAB) MyInput.setKey(Input.RESPAWN, false);
		if(k == Keys.NUMPAD_8 || k == Keys.U) MyInput.setKey(Input.DEBUG_UP, false);
		if(k == Keys.NUMPAD_2 || k == Keys.J) MyInput.setKey(Input.DEBUG_DOWN, false);
		if(k == Keys.NUMPAD_4 || k == Keys.I) MyInput.setKey(Input.DEBUG_LEFT, false);
		if(k == Keys.NUMPAD_6 || k == Keys.O) MyInput.setKey(Input.DEBUG_RIGHT, false);
		if(k == Keys.NUMPAD_7 || k == Keys.LEFT_BRACKET) MyInput.setKey(Input.DEBUG_LEFT2, false);
		if(k == Keys.NUMPAD_9 || k == Keys.RIGHT_BRACKET) MyInput.setKey(Input.DEBUG_RIGHT2, false);
		if(k == Keys.M) MyInput.setKey(Input.DEBUG_CENTER, false);
		if(k == Keys.F1) MyInput.setKey(Input.COLLISION, false);
		if(k == Keys.F2) MyInput.setKey(Input.LIGHTS, false);
		if(k == Keys.F3) MyInput.setKey(Input.DEBUG_TEXT, false);
		if(k == Keys.F4) MyInput.setKey(Input.RENDER, false);
		if(k == Keys.EQUALS) MyInput.setKey(Input.ZOOM_IN, false);
		if(k == Keys.MINUS) MyInput.setKey(Input.ZOOM_OUT, false);
	} else {
		if(k == Keys.ESCAPE){ MyInput.setKey(Input.PAUSE, false); }
		if(k == Keys.SPACE){ MyInput.setKey(Input.JUMP, false); }
		if(k == Keys.ENTER){ MyInput.setKey(Input.ENTER, false); }
		if(k == Keys.LEFT){ MyInput.setKey(Input.LEFT, false); }
		if(k == Keys.RIGHT){  MyInput.setKey(Input.RIGHT, false); }
		if(Keys.toString(k).toLowerCase().equals("delete")){ MyInput.setKey(Input.DOWN, false); }
		if(k == Keys.SHIFT_LEFT || k == Keys.SHIFT_RIGHT){ MyInput.setKey(Input.UP, false); }
	}
	return true;
}
 
开发者ID:JayKEm,项目名称:Aftamath,代码行数:39,代码来源:MyInputProcessor.java

示例8: keyDown

@Override
public boolean keyDown(int keyCode) {
	if (!super.keyDown(keyCode)) {

		if (disableControls) {
			// a selection is already in progress -> ignore any other key input
			return true;
		}

		switch (keyCode) {
			case Keys.UP: {
				decreaseSelection();
				break;
			}
			case Keys.DOWN: {
				increaseSelection();
				break;
			}
			case Keys.ENTER: {
				startSelectionMissile();
				break;
			}
		}
	}

	return true;
}
 
开发者ID:Quillraven,项目名称:Protoman-vs-Megaman,代码行数:27,代码来源:MegamanMenu.java

示例9: keyDown

@Override
public boolean keyDown(int keycode) {
	if (keycode == Keys.ESCAPE && typeListener != null) {
		Game.log("just pressed");
		typeListener.invoke(InputCode.CANCEL);
		return true;
	}
	if (keycode == Keys.ENTER && typeListener != null) {
		typeListener.invoke(InputCode.CONFIRM);
		return true;
	}
	return false;
}
 
开发者ID:adketuri,项目名称:umbracraft,代码行数:13,代码来源:WindowLayout.java

示例10: keyDown

public boolean keyDown(int key) {

		// Up
		if (key == Keys.UP) {
			GameKeys.setKey(GameKeys.UP, true);
		}

		// Down
		if (key == Keys.DOWN) {
			GameKeys.setKey(GameKeys.DOWN, true);
		}

		// Left
		if (key == Keys.LEFT) {
			GameKeys.setKey(GameKeys.LEFT, true);
		}

		// Right
		if (key == Keys.RIGHT) {
			GameKeys.setKey(GameKeys.RIGHT, true);
		}

		// Enter
		if (key == Keys.ENTER) {
			GameKeys.setKey(GameKeys.ENTER, true);
		}

		// Escape
		if (key == Keys.ESCAPE) {
			GameKeys.setKey(GameKeys.ESCAPE, true);
		}

		// Spacebar
		if (key == Keys.SPACE) {
			GameKeys.setKey(GameKeys.SPACE, true);
		}

		// Left Shift
		if (key == Keys.SHIFT_LEFT || key == Keys.SHIFT_RIGHT) {
			GameKeys.setKey(GameKeys.SHIFT, true);
		}

		return true;
	}
 
开发者ID:ja-brouil,项目名称:StarshipFighters,代码行数:44,代码来源:GameInputProcessor.java

示例11: keyUp

public boolean keyUp(int key) {

		// Up
		if (key == Keys.UP) {
			GameKeys.setKey(GameKeys.UP, false);
		}

		// Down
		if (key == Keys.DOWN) {
			GameKeys.setKey(GameKeys.DOWN, false);
		}

		// Left
		if (key == Keys.LEFT) {
			GameKeys.setKey(GameKeys.LEFT, false);
		}

		// Right
		if (key == Keys.RIGHT) {
			GameKeys.setKey(GameKeys.RIGHT, false);
		}

		// Enter
		if (key == Keys.ENTER) {
			GameKeys.setKey(GameKeys.ENTER, false);
		}

		// Escape
		if (key == Keys.ESCAPE) {
			GameKeys.setKey(GameKeys.ESCAPE, false);
		}

		// Spacebar
		if (key == Keys.SPACE) {
			GameKeys.setKey(GameKeys.SPACE, false);
		}

		// Left Shift
		if (key == Keys.SHIFT_LEFT || key == Keys.SHIFT_RIGHT) {
			GameKeys.setKey(GameKeys.SHIFT, false);
		}

		return true;
	}
 
开发者ID:ja-brouil,项目名称:StarshipFighters,代码行数:44,代码来源:GameInputProcessor.java

示例12: keyDown

@Override
public boolean keyDown(InputEvent event, int keyCode) {
    Game.State gameState = Globals.getGameState();
    if (gameState == Game.State.RUNNING || gameState == Game.State.WAIT_FOR_INPUT) {
        if (keyCode == Keys.A) {
            Player player = Level.getInstance().getPlayer();
            if (player != null) {
                player.jump();
            }
        }
    }

    switch (keyCode) {
        case Keys.BACK:
            if (mainMenuOnBack) {
                // TODO: Game.instance.setScreen(new MainMenu(Game.instance));
            }
            break;
        case Keys.ESCAPE:
            Gdx.app.exit();
            break;
        case Keys.D:
            Globals.debugPhysics = !Globals.debugPhysics;
            break;
        case Keys.C:
            DAO.getInstance().clear();
            break;
        case Keys.P:
            Globals.printDebugInfo = !Globals.printDebugInfo;
            break;
        case Keys.E:
            Globals.customCameraInfo = !Globals.customCameraInfo;
            MainCamera.getInstance().setPlayerFocus(true);
            break;
        case Keys.Q:
            MainCamera.getInstance().takeScreenshot();
            break;
        case Keys.ENTER:
            if (Globals.getGameState() == Game.State.LEVEL_COMPLETE) {
                HUD.getInstance().hideLevelComplete();
            }
            Level.getInstance().loadNext();

            break;
        default:
            if (Level.getInstance().getPlayer() != null &&
                    Globals.getGameState() == Game.State.WAIT_FOR_INPUT) {
                Globals.setGameState(Game.State.RUNNING);
            }

            return false;
    }

    return true;
}
 
开发者ID:alexschimpf,项目名称:joe,代码行数:55,代码来源:InputListener.java

示例13: keyDown

@Override
public boolean keyDown(int keycode) {
	if(keycode == Keys.SPACE || keycode == Keys.ENTER) {
		if(messageIndex == 4) {
			if(w.getY() > -32)
				return true;
		}
		
		if(messageIndex < 6)
			Game.gfxMgr.getSound("test", "drum.ogg").play(0.7f);
		else {
			if(messageIndex % 2 == 0) {
				Game.gfxMgr.getSound("test", "doot.wav").play(0.8f);
			} else {
				Game.gfxMgr.getSound("test", "doot.wav").setPitch(
						Game.gfxMgr.getSound("test", "doot.wav").play(0.8f),
						1.5f);
			}
		}
		
		messageIndex++;
		
		if(messageIndex > messageCount)
			messageIndex = messageCount;
		
		if(messageIndex == 4) {
			worldTween = null;
		} else if(messageIndex == 25) {
			alienTween = null;
		} else if(messageIndex == 28) {
			alienTween = null;
		} else if(messageIndex == 34) {
			//switch sturf
			Game.entMgr.getGameInstance().setScreen(new GenerationScene());
		}
		
		return true;
	} else if(keycode == Keys.ESCAPE) {
		Game.entMgr.getGameInstance().setScreen(new GenerationScene());
	}
	
	return false;
}
 
开发者ID:pixelgriffin,项目名称:SPACEJUNK,代码行数:43,代码来源:IntroScene.java

示例14: keyPressed

@Override
public void keyPressed(int key)
{
	// if this input box is NOT selected, just do nothing
	if (!_selected || !_state) return;
	
	switch (key)
	{
		case Keys.RIGHT:
			++_curserPos;
			_curserPos %= (_text.length() + 1);
			break;
		case Keys.LEFT:
			_curserPos--;
			if (_curserPos < 0) _curserPos = _text.length();
			break;
		case Keys.SHIFT_LEFT:
		case Keys.SHIFT_RIGHT:
			_shift = true;
			break;
		case Keys.SPACE:
			charTyped(' ');
			break;
		case Keys.PERIOD:
			charTyped('.');
			break;
		case Keys.COMMA:
			charTyped(',');
			break;
		case Keys.SEMICOLON:
			charTyped(';');
			break;
		case Keys.COLON:
			charTyped(':');
			break;
		case Keys.MINUS:
			charTyped('-');
			break;
		case Keys.BACKSPACE:
			if (_curserPos > 0)
			{
				_text = _text.substring(0, _curserPos - 1) + _text.substring(_curserPos, _text.length());
				_curserPos--;
			}
			break;
		case Keys.ENTER:
		case Keys.ESCAPE:
			METRO.__setSelectedInput(null);
			break;
	}
	// for ranges:
	if (key >= Keys.A && key <= Keys.Z)
	{
		charTyped(_shift ? (char) (36 + key) : (char) (68 + key));
	}
	else if (key >= Keys.NUM_0 && key <= Keys.NUM_9)
	{
		charTyped((char) (key + 41));
	}
	// if length of string in pixel is greater than the width of the field, delete last added character
	if (Draw.getStringSize(_text).width > _area.width)
	{
		_text = _text.substring(0, _curserPos - 1) + _text.substring(_curserPos, _text.length());
		_curserPos--;
	}
}
 
开发者ID:hauke96,项目名称:METRO,代码行数:66,代码来源:InputField.java

示例15: keyDown

public boolean keyDown(int k) {
		if(mode==0){
			if(k == Keys.W || k == Keys.UP) MyInput.setKey(Input.UP, true);
			if(k == Keys.A || k == Keys.LEFT) MyInput.setKey(Input.LEFT, true);
			if(k == Keys.S || k == Keys.DOWN) MyInput.setKey(Input.DOWN, true);
			if(k == Keys.D || k == Keys.RIGHT) MyInput.setKey(Input.RIGHT, true);
			if(k == Keys.SPACE) MyInput.setKey(Input.JUMP, true);
			if(k == Keys.Q || k == Keys.CONTROL_RIGHT) MyInput.setKey(Input.INTERACT, true);
			if(k == Keys.E || k == Keys.NUMPAD_0) MyInput.setKey(Input.ATTACK, true);
			if(k == Keys.SHIFT_LEFT) MyInput.setKey(Input.SPECIAL, true);
			if(k == Keys.CONTROL_LEFT || k == Keys.Z) MyInput.setKey(Input.RUN, true);
			if(k == Keys.R || k == Keys.NUMPAD_1) MyInput.setKey(Input.USE, true);
			if(k == Keys.ESCAPE) MyInput.setKey(Input.PAUSE, true);
			if(k == Keys.ENTER) MyInput.setKey(Input.ENTER, true);
			if(k == Keys.TAB) MyInput.setKey(Input.RESPAWN, true);
			if(k == Keys.NUMPAD_8 || k == Keys.U) MyInput.setKey(Input.DEBUG_UP, true);
			if(k == Keys.NUMPAD_2 || k == Keys.J) MyInput.setKey(Input.DEBUG_DOWN, true);
			if(k == Keys.NUMPAD_4 || k == Keys.I) MyInput.setKey(Input.DEBUG_LEFT, true);
			if(k == Keys.NUMPAD_6 || k == Keys.O) MyInput.setKey(Input.DEBUG_RIGHT, true);
			if(k == Keys.NUMPAD_7 || k == Keys.LEFT_BRACKET) MyInput.setKey(Input.DEBUG_LEFT2, true);
			if(k == Keys.NUMPAD_9 || k == Keys.RIGHT_BRACKET) MyInput.setKey(Input.DEBUG_RIGHT2, true);
			if(k == Keys.M) MyInput.setKey(Input.DEBUG_CENTER, true);
			if(k == Keys.F1) MyInput.setKey(Input.COLLISION, true);
			if(k == Keys.F2) MyInput.setKey(Input.LIGHTS, true);
			if(k == Keys.F3) MyInput.setKey(Input.DEBUG_TEXT, true);
			if(k == Keys.F4) MyInput.setKey(Input.RENDER, true);
			if(k == Keys.EQUALS) MyInput.setKey(Input.ZOOM_IN, true);
			if(k == Keys.MINUS) MyInput.setKey(Input.ZOOM_OUT, true);
		} else {
//			System.out.println(k+":"+Keys.toString(k));
			boolean entered = false;
			if(k == Keys.ESCAPE){ entered=true; MyInput.setKey(Input.PAUSE, true); }
			if(k == Keys.SPACE){ entered=true; MyInput.setKey(Input.JUMP, true); }
			if(k == Keys.ENTER){ entered=true; MyInput.setKey(Input.ENTER, true); }
			if(Keys.toString(k).toLowerCase().equals("delete")){ entered=true; MyInput.setKey(Input.DOWN, true); }
			if(k == Keys.LEFT){ entered=true; MyInput.setKey(Input.LEFT, true); }
			if(k == Keys.RIGHT){ entered=true; MyInput.setKey(Input.RIGHT, true); }
			if(k == Keys.HOME){ entered=true; Game.inputIndex = 0;}
			if(k == Keys.END){ entered=true; Game.inputIndex = Game.getInput().length() - 1; }
			if(k == Keys.SHIFT_LEFT || k == Keys.SHIFT_RIGHT){ entered=true; MyInput.setKey(Input.UP, true); }
			
			if(MyInput.isDown(Input.UP)){
				if(k == Keys.NUM_1){ entered = true; Game.addInputChar("!"); }
				if(k == Keys.NUM_2){ entered = true; Game.addInputChar("@"); }
				if(k == Keys.NUM_3){ entered = true; Game.addInputChar("#"); }
				if(k == Keys.NUM_4){ entered = true; Game.addInputChar("$"); }
				if(k == Keys.NUM_5){ entered = true; Game.addInputChar("%"); }
				if(k == Keys.NUM_6){ entered = true; Game.addInputChar("^"); }
				if(k == Keys.NUM_7){ entered = true; Game.addInputChar("&"); }
				if(k == Keys.NUM_8){ entered = true; Game.addInputChar("*"); }
				if(k == Keys.NUM_9){ entered = true; Game.addInputChar("("); }
				if(k == Keys.NUM_0){ entered = true; Game.addInputChar(")"); }
				if(k == Keys.EQUALS){ entered = true; Game.addInputChar("+"); }
				if(k == Keys.MINUS){ entered = true; Game.addInputChar("_"); }
				if(k == Keys.PERIOD){ entered = true; Game.addInputChar(">"); }
				if(k == Keys.COMMA){ entered = true; Game.addInputChar("<"); }
				if(k == Keys.SLASH){ entered = true; Game.addInputChar("?"); }
			}
			
			if(k == Keys.NUMPAD_1){ k = Keys.NUM_1; }
			if(k == Keys.NUMPAD_2){ k = Keys.NUM_2; }
			if(k == Keys.NUMPAD_3){ k = Keys.NUM_3; }
			if(k == Keys.NUMPAD_4){ k = Keys.NUM_4; }
			if(k == Keys.NUMPAD_5){ k = Keys.NUM_5; }
			if(k == Keys.NUMPAD_6){ k = Keys.NUM_6; }
			if(k == Keys.NUMPAD_7){ k = Keys.NUM_7; }
			if(k == Keys.NUMPAD_8){ k = Keys.NUM_8; }
			if(k == Keys.NUMPAD_9){ k = Keys.NUM_9; }
			if(k == Keys.NUMPAD_0){ k = Keys.NUM_0; }
			
			if(!entered && !ignoreKeys.contains(k, false))
				if(MyInput.isDown(Input.UP) || MyInput.isCaps)
					Game.addInputChar(Keys.toString(k));
				else
					Game.addInputChar(Keys.toString(k).toLowerCase());
		}
		
		return true;
	}
 
开发者ID:JayKEm,项目名称:Aftamath,代码行数:79,代码来源:MyInputProcessor.java


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