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

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

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

Keyboard.getEventNanoseconds介绍

暂无

代码示例

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

char keyChar = Keyboard.getEventCharacter();
if (Keyboard.getEventKeyState() || (keyCode == 0 && keyChar != 0 && Character.isDefined(keyChar))) {
  long timeStamp = Keyboard.getEventNanoseconds();
  event.keyChar = 0;
  event.type = KeyEvent.KEY_UP;
  event.timeStamp = Keyboard.getEventNanoseconds();
  keyEvents.add(event);

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

char keyChar = Keyboard.getEventCharacter();
if (Keyboard.getEventKeyState() || (keyCode == 0 && keyChar != 0 && Character.isDefined(keyChar))) {
  long timeStamp = Keyboard.getEventNanoseconds();
  event.keyChar = 0;
  event.type = KeyEvent.KEY_UP;
  event.timeStamp = Keyboard.getEventNanoseconds();
  keyEvents.add(event);

代码示例来源: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: com.badlogicgames.gdx/gdx-backend-lwjgl

char keyChar = Keyboard.getEventCharacter();
if (Keyboard.getEventKeyState() || (keyCode == 0 && keyChar != 0 && Character.isDefined(keyChar))) {
  long timeStamp = Keyboard.getEventNanoseconds();
  event.keyChar = 0;
  event.type = KeyEvent.KEY_UP;
  event.timeStamp = Keyboard.getEventNanoseconds();
  keyEvents.add(event);

代码示例来源: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: 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: 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: playn/playn

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

相关文章