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

x33g5p2x  于2022-01-25 转载在 其他  
字(6.5k)|赞(0)|评价(0)|浏览(106)

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

Mouse.getEventDWheel介绍

暂无

代码示例

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

@Override
public Queue<MouseAction> getInputQueue() {
  Queue<MouseAction> result = Queues.newArrayDeque();
  while (Mouse.next()) {
    if (Mouse.getEventButton() != -1) {
      ButtonState state = (Mouse.getEventButtonState()) ? ButtonState.DOWN : ButtonState.UP;
      result.add(new MouseAction(InputType.MOUSE_BUTTON.getInput(Mouse.getEventButton()), state, getPosition()));
    }
    if (Mouse.getEventDWheel() != 0) {
      int id = (Mouse.getEventDWheel() > 0) ? 1 : -1;
      result.add(new MouseAction(InputType.MOUSE_WHEEL.getInput(id), id * Mouse.getEventDWheel() / 120, getPosition()));
    }
  }
  return result;
}

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

if (Mouse.getEventDWheel() != 0) {
  event.type = TouchEvent.TOUCH_SCROLLED;
  event.scrollAmount = (int)-Math.signum(Mouse.getEventDWheel());
} else if (pressedButtons.size > 0) {
  event.type = TouchEvent.TOUCH_DRAGGED;

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

if (Mouse.getEventDWheel() != 0) {
  event.type = TouchEvent.TOUCH_SCROLLED;
  event.scrollAmount = (int)-Math.signum(Mouse.getEventDWheel());
} else if (pressedButtons.size > 0) {
  event.type = TouchEvent.TOUCH_DRAGGED;

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

int btn = Mouse.getEventButton();
int wheelDelta = Mouse.getEventDWheel();
int xDelta = Mouse.getEventDX();
int yDelta = Mouse.getEventDY();

代码示例来源:origin: Vazkii/Botania

@Override
public void handleMouseInput() throws IOException {
  super.handleMouseInput();
  if(Mouse.getEventButton() == 0)
    swiped = false;
  int w = Mouse.getEventDWheel();
  if(w < 0)
    nextPage();
  else if(w > 0)
    prevPage();
}

代码示例来源:origin: Vazkii/Botania

@Override
public void handleMouseInput() throws IOException {
  super.handleMouseInput();
  if(Mouse.getEventButton() == 0)
    swiped = false;
  int w = Mouse.getEventDWheel();
  if(w < 0)
    nextPage();
  else if(w > 0)
    prevPage();
}

代码示例来源:origin: AppliedEnergistics/Applied-Energistics-2

@Override
public void handleMouseInput() throws IOException
{
  super.handleMouseInput();
  final int i = Mouse.getEventDWheel();
  if( i != 0 && isShiftKeyDown() )
  {
    final int x = Mouse.getEventX() * this.width / this.mc.displayWidth;
    final int y = this.height - Mouse.getEventY() * this.height / this.mc.displayHeight - 1;
    this.mouseWheelEvent( x, y, i / Math.abs( i ) );
  }
  else if( i != 0 && this.getScrollBar() != null )
  {
    this.getScrollBar().wheel( i );
  }
}

代码示例来源:origin: Direwolf20-MC/BuildingGadgets

@Override
public void handleMouseInput() throws IOException {
  super.handleMouseInput();
  //System.out.println(Mouse.getEventDWheel());
  zoom = initZoom + Mouse.getEventDWheel() / 2;
  if (zoom < -200) zoom = -200;
  if (zoom > 1000) zoom = 1000;
  //System.out.println(zoom);
}

代码示例来源:origin: MightyPirates/TIS-3D

@Override
public void handleMouseInput() throws IOException {
  super.handleMouseInput();
  if (Mouse.hasWheel() && Mouse.getEventDWheel() != 0) {
    if (Math.signum(Mouse.getEventDWheel()) < 0) {
      scrollDown();
    } else {
      scrollUp();
    }
  }
}

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

@Override
public void handleMouseInput() throws IOException {
  super.handleMouseInput();
  if (usesWheel) {
    int wheelMove = Mouse.getEventDWheel();
    if (wheelMove != 0 && this.visible) {
      wheelMove = wheelMove > 0 ? -1 : 1;
      doSetScrollPos(scrollPos + wheelMove * scrollStep);
    }
  }
}

代码示例来源:origin: raoulvdberge/refinedstorage

@Override
public void handleMouseInput() throws IOException {
  super.handleMouseInput();
  int d = Mouse.getEventDWheel();
  if (scrollbar != null && d != 0) {
    scrollbar.wheel(d);
  }
}

代码示例来源:origin: Vazkii/Psi

@Override
public void handleMouseInput() throws IOException {
  super.handleMouseInput();
  int w = Mouse.getEventDWheel();
  int max = getPageCount();
  if(w != 0) {
    int next = page - w / Math.abs(w);
    if(next >= 0 && next < max) {
      page = next;
      updatePanelButtons();
    }
  }
}

代码示例来源:origin: RS485/LogisticsPipes

@Override
public void handleMouseInputSub() throws IOException {
  getActiveTab().onMouseScroll(Mouse.getEventDWheel());
  super.handleMouseInputSub();
}

代码示例来源:origin: Vazkii/Patchouli

@Override
public void handleMouseInput() throws IOException {
  super.handleMouseInput();
  int w = Mouse.getEventDWheel();
  if(w < 0)
    changePage(false, true);
  else if(w > 0)
    changePage(true, true);
}

代码示例来源:origin: lorddusk/HQM

@Override
public void handleMouseInput() throws IOException {
  super.handleMouseInput();
  if (editMenu != null) {
    int x = (Mouse.getEventX() * this.width / this.mc.displayWidth) - left;
    int y = (this.height - Mouse.getEventY() * this.height / this.mc.displayHeight - 1) - top;
    int scroll = Mouse.getEventDWheel();
    if (scroll != 0) {
      editMenu.onScroll(this, x, y, scroll);
    }
  }
}

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

@Override
public void handleMouseInput() throws IOException
{
  super.handleMouseInput();
  int mouseX = Mouse.getEventX() * this.width / this.mc.displayWidth;
  int mouseY = this.height - Mouse.getEventY() * this.height / this.mc.displayHeight - 1;
  int scroll = Mouse.getEventDWheel();
  if(scroll != 0)
  {
    if(windows[0] != null)
    {
      windows[0].handleMouseScroll(mouseX, mouseY, scroll >= 0);
    }
  }
}

代码示例来源:origin: SquidDev-CC/plethora

@Override
public void handleMouseInput() throws IOException {
  super.handleMouseInput();
  int mouseX = Mouse.getEventX() * width / mc.displayWidth;
  int mouseY = height - Mouse.getEventY() * height / mc.displayHeight - 1;
  int wheelChange = Mouse.getEventDWheel();
  if (canInputGlasses()) {
    glassesMouse.update(mouseX, mouseY, wheelChange);
  }
}

代码示例来源:origin: p455w0rd/WirelessCraftingTerminal

@Override
public void handleMouseInput() throws IOException {
  super.handleMouseInput();
  final int i = Mouse.getEventDWheel();
  if (i != 0 && isShiftKeyDown()) {
    final int x = Mouse.getEventX() * width / mc.displayWidth;
    final int y = height - Mouse.getEventY() * height / mc.displayHeight - 1;
    mouseWheelEvent(x, y, i / Math.abs(i));
  }
  else if (i != 0 && getScrollBar() != null) {
    getScrollBar().wheel(i);
  }
}

代码示例来源:origin: mezz/JustEnoughItems

@Override
public void handleMouseInput() throws IOException {
  final int x = Mouse.getEventX() * width / mc.displayWidth;
  final int y = height - Mouse.getEventY() * height / mc.displayHeight - 1;
  if (isMouseOver(x, y)) {
    int scrollDelta = Mouse.getEventDWheel();
    if (scrollDelta < 0) {
      logic.nextPage();
      return;
    } else if (scrollDelta > 0) {
      logic.previousPage();
      return;
    }
  }
  super.handleMouseInput();
}

代码示例来源:origin: P3pp3rF1y/AncientWarfare2

@Override
public void handleMouseInput() throws IOException {
  super.handleMouseInput();
  int x = Mouse.getEventX() * this.width / this.mc.displayWidth;
  int y = this.height - Mouse.getEventY() * this.height / this.mc.displayHeight - 1;
  int button = Mouse.getEventButton();
  boolean state = Mouse.getEventButtonState();
  int wheel = Mouse.getEventDWheel();
  int type = button >= 0 ? (state ? Listener.MOUSE_DOWN : Listener.MOUSE_UP) : wheel != 0 ? Listener.MOUSE_WHEEL : Listener.MOUSE_MOVED;
  ActivationEvent evt = new ActivationEvent(type, button, state, x, y, wheel);
  for (GuiElement element : this.elements) {
    element.handleMouseInput(evt);
  }
}

相关文章