org.lwjglb.engine.Window.isKeyPressed()方法的使用及代码示例

x33g5p2x  于2022-02-03 转载在 其他  
字(9.3k)|赞(0)|评价(0)|浏览(112)

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

Window.isKeyPressed介绍

暂无

代码示例

代码示例来源:origin: lwjglgamedev/lwjglbook

@Override
public void input(Window window) {
  if (window.isKeyPressed(GLFW_KEY_UP)) {
    direction = 1;
  } else if (window.isKeyPressed(GLFW_KEY_DOWN)) {
    direction = -1;
  } else {
    direction = 0;
  }
}

代码示例来源:origin: lwjglgamedev/lwjglbook

@Override
public void input(Window window) {
  if ( window.isKeyPressed(GLFW_KEY_UP) ) {
    direction = 1;
  } else if ( window.isKeyPressed(GLFW_KEY_DOWN) ) {
    direction = -1;
  } else {
    direction = 0;
  }
}

代码示例来源:origin: lwjglgamedev/lwjglbook

@Override
public void input(Window window) {
  if (window.isKeyPressed(GLFW_KEY_UP)) {
    direction = 1;
  } else if (window.isKeyPressed(GLFW_KEY_DOWN)) {
    direction = -1;
  } else {
    direction = 0;
  }
}

代码示例来源:origin: lwjglgamedev/lwjglbook

@Override
public void input(Window window) {
  if (window.isKeyPressed(GLFW_KEY_UP)) {
    direction = 1;
  } else if (window.isKeyPressed(GLFW_KEY_DOWN)) {
    direction = -1;
  } else {
    direction = 0;
  }
}

代码示例来源:origin: lwjglgamedev/lwjglbook

@Override
public void input(Window window) {
  if (window.isKeyPressed(GLFW_KEY_UP)) {
    direction = 1;
  } else if (window.isKeyPressed(GLFW_KEY_DOWN)) {
    direction = -1;
  } else {
    direction = 0;
  }
}

代码示例来源:origin: lwjglgamedev/lwjglbook

@Override
public void input(Window window) {
  displyInc = 0;
  displxInc = 0;
  displzInc = 0;
  scaleInc = 0;
  if (window.isKeyPressed(GLFW_KEY_UP)) {
    displyInc = 1;
  } else if (window.isKeyPressed(GLFW_KEY_DOWN)) {
    displyInc = -1;
  } else if (window.isKeyPressed(GLFW_KEY_LEFT)) {
    displxInc = -1;
  } else if (window.isKeyPressed(GLFW_KEY_RIGHT)) {
    displxInc = 1;
  } else if (window.isKeyPressed(GLFW_KEY_A)) {
    displzInc = -1;
  } else if (window.isKeyPressed(GLFW_KEY_Q)) {
    displzInc = 1;
  } else if (window.isKeyPressed(GLFW_KEY_Z)) {
    scaleInc = -1;
  } else if (window.isKeyPressed(GLFW_KEY_X)) {
    scaleInc = 1;
  }
}

代码示例来源:origin: lwjglgamedev/lwjglbook

@Override
public void input(Window window) {
  displyInc = 0;
  displxInc = 0;
  displzInc = 0;
  scaleInc = 0;
  if (window.isKeyPressed(GLFW_KEY_UP)) {
    displyInc = 1;
  } else if (window.isKeyPressed(GLFW_KEY_DOWN)) {
    displyInc = -1;
  } else if (window.isKeyPressed(GLFW_KEY_LEFT)) {
    displxInc = -1;
  } else if (window.isKeyPressed(GLFW_KEY_RIGHT)) {
    displxInc = 1;
  } else if (window.isKeyPressed(GLFW_KEY_A)) {
    displzInc = -1;
  } else if (window.isKeyPressed(GLFW_KEY_Q)) {
    displzInc = 1;
  } else if (window.isKeyPressed(GLFW_KEY_Z)) {
    scaleInc = -1;
  } else if (window.isKeyPressed(GLFW_KEY_X)) {
    scaleInc = 1;
  }
}

代码示例来源:origin: lwjglgamedev/lwjglbook

@Override
public void input(Window window, MouseInput mouseInput) {
  cameraInc.set(0, 0, 0);
  if (window.isKeyPressed(GLFW_KEY_W)) {
    cameraInc.z = -1;
  } else if (window.isKeyPressed(GLFW_KEY_S)) {
    cameraInc.z = 1;
  }
  if (window.isKeyPressed(GLFW_KEY_A)) {
    cameraInc.x = -1;
  } else if (window.isKeyPressed(GLFW_KEY_D)) {
    cameraInc.x = 1;
  }
  if (window.isKeyPressed(GLFW_KEY_Z)) {
    cameraInc.y = -1;
  } else if (window.isKeyPressed(GLFW_KEY_X)) {
    cameraInc.y = 1;
  }
}

代码示例来源:origin: lwjglgamedev/lwjglbook

@Override
public void input(Window window, MouseInput mouseInput) {
  cameraInc.set(0, 0, 0);
  if (window.isKeyPressed(GLFW_KEY_W)) {
    cameraInc.z = -1;
  } else if (window.isKeyPressed(GLFW_KEY_S)) {
    cameraInc.z = 1;
  }
  if (window.isKeyPressed(GLFW_KEY_A)) {
    cameraInc.x = -1;
  } else if (window.isKeyPressed(GLFW_KEY_D)) {
    cameraInc.x = 1;
  }
  if (window.isKeyPressed(GLFW_KEY_Z)) {
    cameraInc.y = -1;
  } else if (window.isKeyPressed(GLFW_KEY_X)) {
    cameraInc.y = 1;
  }
}

代码示例来源:origin: lwjglgamedev/lwjglbook

@Override
public void input(Window window, MouseInput mouseInput) {
  cameraInc.set(0, 0, 0);
  if (window.isKeyPressed(GLFW_KEY_W)) {
    cameraInc.z = -1;
  } else if (window.isKeyPressed(GLFW_KEY_S)) {
    cameraInc.z = 1;
  }
  if (window.isKeyPressed(GLFW_KEY_A)) {
    cameraInc.x = -1;
  } else if (window.isKeyPressed(GLFW_KEY_D)) {
    cameraInc.x = 1;
  }
  if (window.isKeyPressed(GLFW_KEY_Z)) {
    cameraInc.y = -1;
  } else if (window.isKeyPressed(GLFW_KEY_X)) {
    cameraInc.y = 1;
  }
}

代码示例来源:origin: lwjglgamedev/lwjglbook

@Override
public void input(Window window, MouseInput mouseInput) {
  cameraInc.set(0, 0, 0);
  if (window.isKeyPressed(GLFW_KEY_W)) {
    cameraInc.z = -1;
  } else if (window.isKeyPressed(GLFW_KEY_S)) {
    cameraInc.z = 1;
  }
  if (window.isKeyPressed(GLFW_KEY_A)) {
    cameraInc.x = -1;
  } else if (window.isKeyPressed(GLFW_KEY_D)) {
    cameraInc.x = 1;
  }
  if (window.isKeyPressed(GLFW_KEY_Z)) {
    cameraInc.y = -1;
  } else if (window.isKeyPressed(GLFW_KEY_X)) {
    cameraInc.y = 1;
  }
}

代码示例来源:origin: lwjglgamedev/lwjglbook

@Override
public void input(Window window, MouseInput mouseInput) {
  cameraInc.set(0, 0, 0);
  if (window.isKeyPressed(GLFW_KEY_W)) {
    cameraInc.z = -1;
  } else if (window.isKeyPressed(GLFW_KEY_S)) {
    cameraInc.z = 1;
  }
  if (window.isKeyPressed(GLFW_KEY_A)) {
    cameraInc.x = -1;
  } else if (window.isKeyPressed(GLFW_KEY_D)) {
    cameraInc.x = 1;
  }
  if (window.isKeyPressed(GLFW_KEY_Z)) {
    cameraInc.y = -1;
  } else if (window.isKeyPressed(GLFW_KEY_X)) {
    cameraInc.y = 1;
  }
}

代码示例来源:origin: lwjglgamedev/lwjglbook

@Override
public void input(Window window, MouseInput mouseInput) {
  cameraInc.set(0, 0, 0);
  if (window.isKeyPressed(GLFW_KEY_W)) {
    cameraInc.z = -1;
  } else if (window.isKeyPressed(GLFW_KEY_S)) {
    cameraInc.z = 1;
  }
  if (window.isKeyPressed(GLFW_KEY_A)) {
    cameraInc.x = -1;
  } else if (window.isKeyPressed(GLFW_KEY_D)) {
    cameraInc.x = 1;
  }
  if (window.isKeyPressed(GLFW_KEY_Z)) {
    cameraInc.y = -1;
  } else if (window.isKeyPressed(GLFW_KEY_X)) {
    cameraInc.y = 1;
  }
}

代码示例来源:origin: lwjglgamedev/lwjglbook

@Override
public void input(Window window, MouseInput mouseInput) {
  cameraInc.set(0, 0, 0);
  if (window.isKeyPressed(GLFW_KEY_W)) {
    cameraInc.z = -1;
  } else if (window.isKeyPressed(GLFW_KEY_S)) {
    cameraInc.z = 1;
  }
  if (window.isKeyPressed(GLFW_KEY_A)) {
    cameraInc.x = -1;
  } else if (window.isKeyPressed(GLFW_KEY_D)) {
    cameraInc.x = 1;
  }
  if (window.isKeyPressed(GLFW_KEY_Z)) {
    cameraInc.y = -1;
  } else if (window.isKeyPressed(GLFW_KEY_X)) {
    cameraInc.y = 1;
  }
}

代码示例来源:origin: lwjglgamedev/lwjglbook

@Override
public void input(Window window, MouseInput mouseInput) {
  cameraInc.set(0, 0, 0);
  if (window.isKeyPressed(GLFW_KEY_W)) {
    cameraInc.z = -1;
  } else if (window.isKeyPressed(GLFW_KEY_S)) {
    cameraInc.z = 1;
  }
  if (window.isKeyPressed(GLFW_KEY_A)) {
    cameraInc.x = -1;
  } else if (window.isKeyPressed(GLFW_KEY_D)) {
    cameraInc.x = 1;
  }
  if (window.isKeyPressed(GLFW_KEY_Z)) {
    cameraInc.y = -1;
  } else if (window.isKeyPressed(GLFW_KEY_X)) {
    cameraInc.y = 1;
  }
  if (window.isKeyPressed(GLFW_KEY_LEFT)) {
    angleInc -= 0.05f;
  } else if (window.isKeyPressed(GLFW_KEY_RIGHT)) {
    angleInc += 0.05f;
  } else {
    angleInc = 0;
  }
}

代码示例来源:origin: lwjglgamedev/lwjglbook

@Override
public void input(Window window, MouseInput mouseInput) {
  cameraInc.set(0, 0, 0);
  if (window.isKeyPressed(GLFW_KEY_W)) {
    cameraInc.z = -1;
  } else if (window.isKeyPressed(GLFW_KEY_S)) {
    cameraInc.z = 1;
  }
  if (window.isKeyPressed(GLFW_KEY_A)) {
    cameraInc.x = -1;
  } else if (window.isKeyPressed(GLFW_KEY_D)) {
    cameraInc.x = 1;
  }
  if (window.isKeyPressed(GLFW_KEY_Z)) {
    cameraInc.y = -1;
  } else if (window.isKeyPressed(GLFW_KEY_X)) {
    cameraInc.y = 1;
  }
  if (window.isKeyPressed(GLFW_KEY_LEFT)) {
    angleInc -= 0.05f;
  } else if (window.isKeyPressed(GLFW_KEY_RIGHT)) {
    angleInc += 0.05f;
  } else {
    angleInc = 0;
  }
}

代码示例来源:origin: lwjglgamedev/lwjglbook

@Override
public void input(Window window, MouseInput mouseInput) {
  cameraInc.set(0, 0, 0);
  if (window.isKeyPressed(GLFW_KEY_W)) {
    cameraInc.z = -1;
  } else if (window.isKeyPressed(GLFW_KEY_S)) {
    cameraInc.z = 1;
  }
  if (window.isKeyPressed(GLFW_KEY_A)) {
    cameraInc.x = -1;
  } else if (window.isKeyPressed(GLFW_KEY_D)) {
    cameraInc.x = 1;
  }
  if (window.isKeyPressed(GLFW_KEY_Z)) {
    cameraInc.y = -1;
  } else if (window.isKeyPressed(GLFW_KEY_X)) {
    cameraInc.y = 1;
  }
  if (window.isKeyPressed(GLFW_KEY_LEFT)) {
    angleInc -= 0.05f;
  } else if (window.isKeyPressed(GLFW_KEY_RIGHT)) {
    angleInc += 0.05f;
  } else {
    angleInc = 0;
  }
}

代码示例来源:origin: lwjglgamedev/lwjglbook

@Override
public void input(Window window, MouseInput mouseInput) {
  cameraInc.set(0, 0, 0);
  if (window.isKeyPressed(GLFW_KEY_W)) {
    cameraInc.z = -1;
  } else if (window.isKeyPressed(GLFW_KEY_S)) {
    cameraInc.z = 1;
  }
  if (window.isKeyPressed(GLFW_KEY_A)) {
    cameraInc.x = -1;
  } else if (window.isKeyPressed(GLFW_KEY_D)) {
    cameraInc.x = 1;
  }
  if (window.isKeyPressed(GLFW_KEY_Z)) {
    cameraInc.y = -1;
  } else if (window.isKeyPressed(GLFW_KEY_X)) {
    cameraInc.y = 1;
  }
  float lightPos = pointLight.getPosition().z;
  if (window.isKeyPressed(GLFW_KEY_N)) {
    this.pointLight.getPosition().z = lightPos + 0.1f;
  } else if (window.isKeyPressed(GLFW_KEY_M)) {
    this.pointLight.getPosition().z = lightPos - 0.1f;
  }
}

代码示例来源:origin: lwjglgamedev/lwjglbook

@Override
public void input(Window window, MouseInput mouseInput) {
  cameraInc.set(0, 0, 0);
  if (window.isKeyPressed(GLFW_KEY_W)) {
    cameraInc.z = -1;
  } else if (window.isKeyPressed(GLFW_KEY_S)) {
    cameraInc.z = 1;
  }
  if (window.isKeyPressed(GLFW_KEY_A)) {
    cameraInc.x = -1;
  } else if (window.isKeyPressed(GLFW_KEY_D)) {
    cameraInc.x = 1;
  }
  if (window.isKeyPressed(GLFW_KEY_Z)) {
    cameraInc.y = -1;
  } else if (window.isKeyPressed(GLFW_KEY_X)) {
    cameraInc.y = 1;
  }
  float lightPos = spotLightList[0].getPointLight().getPosition().z;
  if (window.isKeyPressed(GLFW_KEY_N)) {
    this.spotLightList[0].getPointLight().getPosition().z = lightPos + 0.1f;
  } else if (window.isKeyPressed(GLFW_KEY_M)) {
    this.spotLightList[0].getPointLight().getPosition().z = lightPos - 0.1f;
  }
}

代码示例来源:origin: lwjglgamedev/lwjglbook

@Override
public void input(Window window, MouseInput mouseInput) {
  cameraInc.set(0, 0, 0);
  if (window.isKeyPressed(GLFW_KEY_W)) {
    cameraInc.z = -1;
  } else if (window.isKeyPressed(GLFW_KEY_S)) {
    cameraInc.z = 1;
  }
  if (window.isKeyPressed(GLFW_KEY_A)) {
    cameraInc.x = -1;
  } else if (window.isKeyPressed(GLFW_KEY_D)) {
    cameraInc.x = 1;
  }
  if (window.isKeyPressed(GLFW_KEY_Z)) {
    cameraInc.y = -1;
  } else if (window.isKeyPressed(GLFW_KEY_X)) {
    cameraInc.y = 1;
  }
  float lightPos = spotLight.getPointLight().getPosition().z;
  if (window.isKeyPressed(GLFW_KEY_N)) {
    this.spotLight.getPointLight().getPosition().z = lightPos + 0.1f;
  } else if (window.isKeyPressed(GLFW_KEY_M)) {
    this.spotLight.getPointLight().getPosition().z = lightPos - 0.1f;
  }
}

相关文章