org.lwjgl.input.Keyboard.next()方法的使用及代码示例

x33g5p2x  于2022-01-23 转载在 其他  
字(6.9k)|赞(0)|评价(0)|浏览(97)

本文整理了Java中org.lwjgl.input.Keyboard.next()方法的一些代码示例,展示了Keyboard.next()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Keyboard.next()方法的具体详情如下:
包路径:org.lwjgl.input.Keyboard
类名称:Keyboard
方法名:next

Keyboard.next介绍

暂无

代码示例

代码示例来源:origin: MovingBlocks/Terasology

@Override
  public Queue<KeyboardAction> getInputQueue() {
    Queue<KeyboardAction> result = Queues.newArrayDeque();

    while (Keyboard.next()) {
      ButtonState state;
      if (Keyboard.isRepeatEvent()) {
        state = ButtonState.REPEAT;
      } else {
        state = (Keyboard.getEventKeyState()) ? ButtonState.DOWN : ButtonState.UP;
      }
      Input input = InputType.KEY.getInput(Keyboard.getEventKey());
      result.add(new KeyboardAction(input, state, Keyboard.getEventCharacter()));
    }

    return result;
  }
}

代码示例来源:origin: libgdx/libgdx

while (Keyboard.next()) {
  int keyCode = getGdxKeyCode(Keyboard.getEventKey());
  char keyChar = Keyboard.getEventCharacter();

代码示例来源:origin: libgdx/libgdx

while (Keyboard.next()) {
  int keyCode = getGdxKeyCode(Keyboard.getEventKey());
  char keyChar = Keyboard.getEventCharacter();

代码示例来源:origin: jMonkeyEngine/jmonkeyengine

public void update() {
  if (!context.isRenderable())
    return;
  
  Keyboard.poll();
  while (Keyboard.next()){
    int keyCode = Keyboard.getEventKey();
    char keyChar = Keyboard.getEventCharacter();
    boolean pressed = Keyboard.getEventKeyState();
    boolean down = Keyboard.isRepeatEvent();
    long time = Keyboard.getEventNanoseconds();
    KeyInputEvent evt = new KeyInputEvent(keyCode, keyChar, pressed, down);
    evt.setTime(time);
    listener.onKeyEvent(evt);
  }
}

代码示例来源:origin: AntiqueAtlasTeam/AntiqueAtlas

@Override
public void handleInput() throws IOException {
  // Traverse children backwards, because the topmost child should be the
  // first to process input:
  ListIterator<GuiComponent> iter = children.listIterator(children.size());
  while(iter.hasPrevious()) {
    GuiComponent child = iter.previous();
    if (child.blocksScreen) {
      child.handleInput();
      isMouseOver = false;
      return;
    }
  }
  if (interceptsMouse) {
    while (Mouse.next()) {
      this.handleMouseInput();
    }
  }
  if (interceptsKeyboard) {
    while (Keyboard.next()) {
      this.handleKeyboardInput();
    }
  }
}

代码示例来源:origin: nifty-gui/nifty-gui

private void processKeyboardEvents(@Nonnull final NiftyInputConsumer inputEventConsumer) {
 while (Keyboard.next()) {
  KeyboardInputEvent event = keyboardEventCreator.createEvent(Keyboard.getEventKey(),
    Keyboard.getEventCharacter(), Keyboard.getEventKeyState());
  // due to or short-circuiting on true, the event will get forward to keyboardEventsOut if keyboardEventsOut=true
  if (!niftyHasKeyboardFocus || !inputEventConsumer.processKeyboardEvent(event)) {
   keyboardEventsOut.offer(event);
  }
 }
}

代码示例来源:origin: com.ardor3d/ardor3d-lwjgl

@Override
  protected KeyEvent computeNext() {
    if (!Keyboard.next()) {
      return endOfData();
    }
    final int keyCode = Keyboard.getEventKey();
    final boolean pressed = Keyboard.getEventKeyState();
    final char keyChar = Keyboard.getEventCharacter();
    final Key k = LwjglKey.findByCode(keyCode);
    return new KeyEvent(k, pressed ? KeyState.DOWN : KeyState.UP, keyChar);
  }
}

代码示例来源:origin: MrCrayfish/ModelCreator

private void handleKeyboardInput()
{
  while(Keyboard.next())
  {
    int modifiers = 0;
    if(KeyboardUtil.isCtrlKeyDown())
    {
      modifiers += InputEvent.CTRL_MASK;
    }
    if(KeyboardUtil.isShiftKeyDown())
    {
      modifiers += InputEvent.SHIFT_MASK;
    }
    if(KeyboardUtil.isAltKeyDown())
    {
      modifiers += InputEvent.ALT_MASK;
    }
    int code = Keyboard.getEventKey();
    int finalModifiers = modifiers;
    if(Keyboard.getEventKeyState())
    {
      SwingUtilities.invokeLater(() -> this.handleKeyAction(code, finalModifiers, false, true));
    }
    else
    {
      SwingUtilities.invokeLater(() -> this.handleKeyAction(code, finalModifiers, false, false));
    }
  }
}

代码示例来源:origin: org.lwjgl.lwjgl/lwjgl_util

protected synchronized boolean getNextDeviceEvent(Event event) throws IOException {
  if (!org.lwjgl.input.Keyboard.isCreated())
    return false;
  if (!org.lwjgl.input.Keyboard.next())
    return false;
  int lwjgl_key = org.lwjgl.input.Keyboard.getEventKey();
  if (lwjgl_key == org.lwjgl.input.Keyboard.KEY_NONE)
    return false;
  Component.Identifier.Key key_id = KeyMap.map(lwjgl_key);
  if (key_id == null)
    return false;
  Component key = getComponent(key_id);
  if (key == null)
    return false;
  float value = org.lwjgl.input.Keyboard.getEventKeyState() ? 1 : 0;
  event.set(key, value, org.lwjgl.input.Keyboard.getEventNanoseconds());
  return true;
}

代码示例来源:origin: com.badlogicgames.gdx/gdx-backend-lwjgl

while (Keyboard.next()) {
  int keyCode = getGdxKeyCode(Keyboard.getEventKey());
  char keyChar = Keyboard.getEventCharacter();

代码示例来源:origin: monster860/FastDMM

while (Keyboard.next()) {
  if (Keyboard.getEventKeyState()) {
    if (Keyboard.getEventKey() == Keyboard.KEY_LCONTROL || Keyboard.getEventKey() == Keyboard.KEY_RCONTROL)

代码示例来源:origin: us.ihmc.thirdparty.jme/jme3-lwjgl

public void update() {
  if (!context.isRenderable())
    return;
  
  Keyboard.poll();
  while (Keyboard.next()){
    int keyCode = Keyboard.getEventKey();
    char keyChar = Keyboard.getEventCharacter();
    boolean pressed = Keyboard.getEventKeyState();
    boolean down = Keyboard.isRepeatEvent();
    long time = Keyboard.getEventNanoseconds();
    KeyInputEvent evt = new KeyInputEvent(keyCode, keyChar, pressed, down);
    evt.setTime(time);
    listener.onKeyEvent(evt);
  }
}

代码示例来源:origin: org.slick2d/slick2d-core

clearMousePressedRecord();
  while (Keyboard.next()) {}
  while (Mouse.next()) {}
  return;
while (Keyboard.next()) {
  if (Keyboard.getEventKeyState()) {
    int eventKey = resolveEventKey(Keyboard.getEventKey(), Keyboard.getEventCharacter());

代码示例来源:origin: threerings/playn

@Override
void update() {
 Modifiers modifiers = extractModifiers();
 while (Keyboard.next()) {
  double time = (double) (Keyboard.getEventNanoseconds() / 1000);
  int keyCode = Keyboard.getEventKey();
  if (Keyboard.getEventKeyState()) {
   Key key = translateKey(keyCode);
   if (key != null)
    dispatch(new Event.Impl(new Events.Flags.Impl(), time, key, modifiers), down);
   char keyChar = Keyboard.getEventCharacter();
   if (!Character.isISOControl(keyChar))
    dispatch(new TypedEvent.Impl(new Events.Flags.Impl(), time, keyChar), typed);
  } else {
   Key key = translateKey(keyCode);
   if (key != null)
    dispatch(new Event.Impl(new Events.Flags.Impl(), time, key, modifiers), up);
  }
 }
 super.update();
}

代码示例来源:origin: com.googlecode.playn/playn-java

@Override
void update() {
 Modifiers modifiers = extractModifiers();
 while (Keyboard.next()) {
  double time = (double) (Keyboard.getEventNanoseconds() / 1000);
  int keyCode = Keyboard.getEventKey();
  if (Keyboard.getEventKeyState()) {
   Key key = translateKey(keyCode);
   if (key != null)
    dispatch(new Event.Impl(new Events.Flags.Impl(), time, key, modifiers), down);
   char keyChar = Keyboard.getEventCharacter();
   if (!Character.isISOControl(keyChar))
    dispatch(new TypedEvent.Impl(new Events.Flags.Impl(), time, keyChar), typed);
  } else {
   Key key = translateKey(keyCode);
   if (key != null)
    dispatch(new Event.Impl(new Events.Flags.Impl(), time, key, modifiers), up);
  }
 }
 super.update();
}

代码示例来源:origin: montoyo/mcef

@Override
public void handleInput() {
  while(Keyboard.next()) {
    if(Keyboard.getEventKey() == Keyboard.KEY_ESCAPE) {
      drawSquare = false;

代码示例来源:origin: org.ode4j/demo

while(Keyboard.next()) {
  char key = (char) Keyboard.getEventKey();
  if (key == Keyboard.KEY_ESCAPE) {

代码示例来源:origin: montoyo/mcef

@Override
public void handleInput() {
  while(Keyboard.next()) {
    if(Keyboard.getEventKey() == Keyboard.KEY_ESCAPE) {
      mc.displayGuiScreen(null);

代码示例来源:origin: playn/playn

while (Keyboard.next()) {
 double time = (double) (Keyboard.getEventNanoseconds() / 1000000);
 int keyCode = Keyboard.getEventKey();

相关文章