本文整理汇总了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);
}
示例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);
}