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


Java Keyboard.KEY_W屬性代碼示例

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


在下文中一共展示了Keyboard.KEY_W屬性的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: update

/**
 * Game loop update
 */
public void update() {
	while (Keyboard.next()) {
		if (Keyboard.getEventKeyState()) {
			if (Keyboard.getEventKey() == Keyboard.KEY_Q) {
				// play as a one off sound effect
				oggEffect.playAsSoundEffect(1.0f, 1.0f, false);
			}
			if (Keyboard.getEventKey() == Keyboard.KEY_W) {
				// replace the music thats curretly playing with 
				// the ogg
				oggStream.playAsMusic(1.0f, 1.0f, true);
			}
			if (Keyboard.getEventKey() == Keyboard.KEY_E) {
				// replace the music thats curretly playing with 
				// the mod
				modStream.playAsMusic(1.0f, 1.0f, true);
			}
			if (Keyboard.getEventKey() == Keyboard.KEY_R) {
				// play as a one off sound effect
				aifEffect.playAsSoundEffect(1.0f, 1.0f, false);
			}
			if (Keyboard.getEventKey() == Keyboard.KEY_T) {
				// play as a one off sound effect
				wavEffect.playAsSoundEffect(1.0f, 1.0f, false);
			}
		}
	}
	
	// polling is required to allow streaming to get a chance to
	// queue buffers.
	SoundStore.get().poll(0);
}
 
開發者ID:j-dong,項目名稱:trashjam2017,代碼行數:35,代碼來源:TestUtils.java

示例2: keyUp

@Override
public void keyUp(int keycode)
{
    if (keycode == Keyboard.KEY_W || keycode == Keyboard.KEY_UP)
        setSelected(selected - 1);
    if (keycode == Keyboard.KEY_S || keycode == Keyboard.KEY_DOWN)
        setSelected(selected + 1);
}
 
開發者ID:PearXTeam,項目名稱:PurificatiMagicae,代碼行數:8,代碼來源:GuiIfTabletSESelector.java


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