當前位置: 首頁>>代碼示例>>Java>>正文


Java Keys.LEFT屬性代碼示例

本文整理匯總了Java中com.badlogic.gdx.Input.Keys.LEFT屬性的典型用法代碼示例。如果您正苦於以下問題:Java Keys.LEFT屬性的具體用法?Java Keys.LEFT怎麽用?Java Keys.LEFT使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在com.badlogic.gdx.Input.Keys的用法示例。


在下文中一共展示了Keys.LEFT屬性的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) {
		ePressed = true;
	} else if (keycode == Keys.W) {
		wPressed = true;
	}

	return false;
}
 
開發者ID:libgdx-examples,項目名稱:base-template,代碼行數:21,代碼來源:InputHandler.java

示例2: keyUp

@Override
public boolean keyUp(int keycode) {
	
	if (keycode == Keys.UP) {
		upPressed = false;
	} else if (keycode == Keys.LEFT) {
		leftPressed = false;
	} else if (keycode == Keys.DOWN) {
		downPressed = false;
	} else if (keycode == Keys.RIGHT) {
		rightPressed = false;
	}
	
	// When releasing the action key, reset the key delay so they can be pressed again immediately
	if (keycode == Keys.E) {
		ePressed = false;
		actionDelay = 0;
	}
	
	return false;
}
 
開發者ID:libgdx-examples,項目名稱:base-template,代碼行數:21,代碼來源:InputHandler.java

示例3: 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

示例4: keyUp

@Override
public boolean keyUp(int keycode) {
	
	if (keycode == Keys.UP) {
		upPressed = false;
	} else if (keycode == Keys.LEFT) {
		leftPressed = false;
	} else if (keycode == Keys.DOWN) {
		downPressed = false;
	} else if (keycode == Keys.RIGHT) {
		rightPressed = false;
	}
	
	// When releasing the action key, reset the key delay so they can be pressed again immediately
	if (keycode == Keys.E) {
		firePressed = false;
		actionDelay = 0;
	}
	
	return false;
}
 
開發者ID:libgdx-examples,項目名稱:space-arcade,代碼行數:21,代碼來源:InputHandler.java

示例5: keyDown

@Override
public boolean keyDown (int keycode) {
	switch (keycode) {
	case Keys.DOWN:
		downPressed = true;
		break;
	case Keys.UP:
		upPressed = true;
		break;
	case Keys.LEFT:
		leftPressed = true;
		break;
	case Keys.RIGHT:
		rightPressed = true;
		break;
	}
	return super.keyDown(keycode);
}
 
開發者ID:Matsemann,項目名稱:eamaster,代碼行數:18,代碼來源:VehicleTest.java

示例6: keyUp

@Override
public boolean keyUp (int keycode) {
	switch (keycode) {
	case Keys.DOWN:
		downPressed = false;
		break;
	case Keys.UP:
		upPressed = false;
		break;
	case Keys.LEFT:
		leftPressed = false;
		break;
	case Keys.RIGHT:
		rightPressed = false;
		break;
	case Keys.R:
		chassis.body.setWorldTransform(chassis.transform.setToTranslation(0, 5, 0));
		chassis.body.setInterpolationWorldTransform(chassis.transform);
		((btRigidBody)(chassis.body)).setLinearVelocity(Vector3.Zero);
		((btRigidBody)(chassis.body)).setAngularVelocity(Vector3.Zero);
		chassis.body.activate();
		break;
	}
	return super.keyUp(keycode);
}
 
開發者ID:Matsemann,項目名稱:eamaster,代碼行數:25,代碼來源:VehicleTest.java

示例7: keyDown

@Override
public boolean keyDown(int keycode) {
	if (keycode == Keys.LEFT)
		controller.leftPressed();
	if (keycode == Keys.RIGHT)
		controller.rightPressed();
	if (keycode == Keys.DOWN)
	{
		controller.downPressed();
	}
	if(keycode == Keys.BACK) {
		if (isMultiPlayer) {
			NextpeerPlugin.reportForfeitForCurrentTournament();
		}

		dispose();
		System.out.println("c");
		game.setScreen(new MainScreen(game));
	}

	return true;
}
 
開發者ID:Nextpeer,項目名稱:SkiFun,代碼行數:22,代碼來源:GameScreen.java

示例8: keyDown

@Override
public boolean keyDown(final int keycode) {
	switch (keycode) {
	case Keys.UP:
		TurnScheduler.getInstance().addTurnToQueue(Move.UP);
		return true;
	case Keys.DOWN:
		TurnScheduler.getInstance().addTurnToQueue(Move.DOWN);
		return true;
	case Keys.LEFT:
		TurnScheduler.getInstance().addTurnToQueue(Move.LEFT);
		return true;
	case Keys.RIGHT:
		TurnScheduler.getInstance().addTurnToQueue(Move.RIGHT);
		return true;
	default:
		return false;
	}
}
 
開發者ID:davidbecker,項目名稱:taloonerrl,代碼行數:19,代碼來源:InputSystem.java

示例9: keyUp

@Override
public boolean keyUp(int optionIndex, int keyOrButtonCode) {
	switch (optionIndex) {
		case OPTION_MUSIC: {
			if (Keys.LEFT == keyOrButtonCode || Keys.RIGHT == keyOrButtonCode) {
				volumeChange = 0;
			}
			break;
		}
		case OPTION_SOUND: {
			if (Keys.LEFT == keyOrButtonCode || Keys.RIGHT == keyOrButtonCode) {
				volumeChange = 0;
			}
			break;
		}
	}

	return false;
}
 
開發者ID:Quillraven,項目名稱:Protoman-vs-Megaman,代碼行數:19,代碼來源:AudioMenuPage.java

示例10: 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

示例11: keyDown

public boolean keyDown(int keycode) {
	switch(keycode) {
	case Keys.A:case Keys.LEFT: leftFlag = true; break;
	case Keys.D:case Keys.RIGHT:rightFlag = true;break;
	case Keys.SPACE:jumpFlag = true;break;
	}
	return false;
}
 
開發者ID:mingwuyun,項目名稱:cocos2d-java,代碼行數:8,代碼來源:Base2dTests.java

示例12: keyUp

public boolean keyUp(int keycode) {
	switch(keycode) {case Keys.A:case Keys.LEFT:leftFlag = false;break;
	case Keys.D:case Keys.RIGHT:rightFlag = false;break;
	case Keys.SPACE:jumpFlag = false;break;
	}
	return false;
}
 
開發者ID:mingwuyun,項目名稱:cocos2d-java,代碼行數:7,代碼來源:Base2dTests.java

示例13: KeyboardControl

public KeyboardControl() {
    // Initial settings:
    up = Keys.UP;
    down = Keys.DOWN;
    left = Keys.LEFT;
    right = Keys.RIGHT;
}
 
開發者ID:BialJam,項目名稱:M-M,代碼行數:7,代碼來源:KeyboardControl.java

示例14: onTurn

@Override
/*********************************************************
 * Called on every turn
 * @return true if something actually happened in a turn
 * (if false, the player is NOT moved in the queue!)
 *********************************************************/
public boolean onTurn(){
	super.onTurn();
	Core.redraw = true; 
	Integer log = input.checkKeys();
	if (log == null) return false; 
	switch (log){
	case Keys.LEFT: 
		move(-1, 0);
		break; 
	case Keys.RIGHT:
		move(1, 0);
		break; 
	case Keys.UP:
		move(0, 1);
		break; 
	case Keys.DOWN:
		move(0, -1); 
		break; 
	case Keys.E:
		Core.game.setScreen(new DungeonOverviewScreen(holder.getDungeon().getWorld()));
	case Keys.X:
		holder.useStairs();
		holder.getDungeon().getWorld().changeFloors(holder.getDungeon());
		break; 
	default:
		return false; 
	}
	housekeep(); 
	return true; 
}
 
開發者ID:lries,項目名稱:Oozelike,代碼行數:36,代碼來源:PlayerAI.java

示例15: checkKeys

/********************************************
 * Check keys for presses
 * Automatically converts synonymous keys
 * @return the highest priority active key
 ********************************************/
public Integer checkKeys(){
	if (checkKey(Keys.UP) || checkKey(Keys.W)) return Keys.UP;
	if (checkKey(Keys.DOWN) || checkKey(Keys.S)) return Keys.DOWN;
	if (checkKey(Keys.LEFT) || checkKey(Keys.A)) return Keys.LEFT;
	if (checkKey(Keys.RIGHT) || checkKey(Keys.D)) return Keys.RIGHT;
	if (checkNewKey(Keys.X)) return Keys.X;
	if (checkNewKey(Keys.E)) return Keys.E; 
	return null; 
}
 
開發者ID:lries,項目名稱:Oozelike,代碼行數:14,代碼來源:KeyLogger.java


注:本文中的com.badlogic.gdx.Input.Keys.LEFT屬性示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。