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

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

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

Mouse.getDWheel介绍

暂无

代码示例

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

public RequestMonitorPopup(PipeBlockRequestTable table, int orderId) {
  super(256, 202, 0, 0);
  _table = table;
  this.orderId = orderId;
  guiMapY = -200;
  Mouse.getDWheel(); // Reset DWheel on GUI open
}

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

@Override
public void handleMouseInputSub() throws IOException {
  int wheel = org.lwjgl.input.Mouse.getDWheel() / 120;
  if (wheel == 0) {
    super.handleMouseInputSub();
  }
  if (wheel < 0) {
    wheeldown = wheel * -1;
  } else {
    wheelup = wheel;
  }
}

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

public LogicLayoutGui(LogicController controller, EntityPlayer player) {
  super(256, 202 + 90, 0, 0);
  this.controller = controller;
  guiMapY = -200;
  Mouse.getDWheel(); // Reset DWheel on GUI open
  DummyContainer dummy = new DummyContainer(player.inventory, null);
  dummy.addNormalSlotsForPlayerInventory(50, 205);
  inventorySlots = dummy;
}

代码示例来源:origin: Esteemed-Innovation/Esteemed-Innovation

private void handleDWheelMovement() {
  int dWheelRecentMovement = Mouse.getDWheel();
  if (dWheelRecentMovement < 0 && buttonNextPage.visible) {
    actionPerformed(buttonNextPage);
  }
  if (dWheelRecentMovement > 0 && buttonPreviousPage.visible) {
    actionPerformed(buttonPreviousPage);
  }
}

代码示例来源:origin: gegy1000/Terrarium

public void updateMouse(int mouseX, int mouseY) {
  this.prevMouseX = mouseX;
  this.prevMouseY = mouseY;
  int scroll = Mouse.getDWheel();
  if (this.isSelected(mouseX, mouseY)) {
    this.zoom = MathHelper.clamp(this.zoom + scroll / 1600.0F, this.minZoom, this.maxZoom);
  }
}

代码示例来源:origin: TehNut/HWYLA

public ScreenBase(GuiScreen parent) {
  this.parent = parent;
  this.mc = Minecraft.getMinecraft();
  this.widgets = new HashMap<>();
  this.addWidget("canvas", new LayoutCanvas());
  Mouse.getDWheel();            // We init the DWheel method (getDWheel returns the value since the last call, so we have to call it once on ui creation)
}

代码示例来源:origin: PenguinSquad/Harvest-Festival

@Override
public void handleMouseInput() throws IOException {
  int x = Mouse.getEventX() * width / mc.displayWidth;
  int y = height - Mouse.getEventY() * height / mc.displayHeight - 1;
  mouseX = x - guiLeft;
  mouseY = y - guiTop;
  mouseWheel = Mouse.getDWheel();
  super.handleMouseInput();
}

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

@Override
public void handleMouseInputSub() throws IOException {
  int wheel = org.lwjgl.input.Mouse.getDWheel() / 120;
  if (wheel == 0) {
    super.handleMouseInputSub();
  }
  if (wheel < 0) {
    textList.scrollUp();
  } else if (wheel > 0) {
    textList.scrollDown();
  }
}

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

@Override
public void handleMouseInput() throws IOException {
  super.handleMouseInput();
  int dWheel = Mouse.getDWheel();
  if (dWheel != 0) {
    window.postEvent(new GuiEvent.WheelEvent(window, dWheel), GuiEventDestination.ALL);
  }
}

代码示例来源:origin: ForestryMC/Binnie

@Override
public void handleMouseInput() throws IOException {
  super.handleMouseInput();
  final int dWheel = Mouse.getDWheel();
  if (dWheel != 0) {
    this.window.callEvent(new EventMouse.Wheel(this.window, dWheel));
  }
}

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

@Override
public void handleMouseInputSub() throws IOException {
  int wheel = org.lwjgl.input.Mouse.getDWheel() / 120;
  if (wheel == 0) {
    super.handleMouseInputSub();
  }
  if (wheel < 0) {
    textList.scrollUp();
  } else if (wheel > 0) {
    textList.scrollDown();
  }
}

代码示例来源:origin: PenguinSquad/Harvest-Festival

@Override
  public void handleMouseInput() throws IOException {
    int x = Mouse.getEventX() * width / mc.displayWidth;
    int y = height - Mouse.getEventY() * height / mc.displayHeight - 1;
    mouseX = x - guiLeft;
    mouseY = y - guiTop;
    mouseWheel = Mouse.getDWheel();
    super.handleMouseInput();
  }
}

代码示例来源:origin: TehNut/HWYLA

public LayoutCanvas() {
  super(null);
  this.setGeometry(0, 0, this.rez.getScaledWidth(), this.rez.getScaledHeight(), CType.ABSXY, CType.ABSXY);
  Mouse.getDWheel();    // This is to "calibrate" the DWheel
  this.lastMouseEvent = new MouseEvent(this);
}

代码示例来源:origin: ldtteam/minecolonies

@Override
public void handleMouseInput() throws IOException
{
  super.handleMouseInput();
  final int wheel = Mouse.getDWheel();
  final int mx = Mouse.getEventX() * super.width / super.mc.displayWidth - x;
  final int my = super.height - Mouse.getEventY() * super.height / super.mc.displayHeight - 1 - y;
  window.handleHover(mx, my);
  if(wheel != 0)
  {
    window.scrollInput(wheel);
  }
}

代码示例来源:origin: ExtraCells/ExtraCells2

@Override
public void initGui() {
  super.initGui();
  Mouse.getDWheel();
  updateFluids();
  Collections.sort(this.fluidWidgets, new FluidWidgetComparator());
  this.searchbar = new GuiTextField(0, this.fontRenderer, this.guiLeft + 81, this.guiTop + 6, 88, 10) {
    private int xPos = 0;
    private int yPos = 0;
    private int width = 0;
    private int height = 0;
    @Override
    public boolean mouseClicked(int x, int y, int mouseBtn) {
      boolean flag = x >= this.xPos && x < this.xPos + this.width && y >= this.yPos && y < this.yPos + this.height;
      if (flag && mouseBtn == 3) {
        setText("");
      }
      return flag;
    }
  };
  this.searchbar.setEnableBackgroundDrawing(false);
  this.searchbar.setFocused(true);
  this.searchbar.setMaxStringLength(15);
}

代码示例来源:origin: ExtraCells/ExtraCells2

@Override
public void initGui() {
  super.initGui();
  Mouse.getDWheel();
  updateFluids();
  Collections.sort(this.fluidWidgets, new FluidWidgetComparator());
  this.searchbar = new GuiTextField(0, this.fontRenderer,
    this.guiLeft + 81, this.guiTop + 6, 88, 10) {
    private int xPos = 0;
    private int yPos = 0;
    private int width = 0;
    private int height = 0;
    @Override
    public boolean mouseClicked(int x, int y, int mouseBtn) {
      boolean flag = x >= this.xPos && x < this.xPos + this.width
        && y >= this.yPos && y < this.yPos + this.height;
      if (flag && mouseBtn == 3) {
        setText("");
      }
      return flag;
    }
  };
  this.searchbar.setEnableBackgroundDrawing(false);
  this.searchbar.setFocused(true);
  this.searchbar.setMaxStringLength(15);
}

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

/**
 * Updates our "model"
 *
 */
private void updateState() {
  int dx = Mouse.getDX();
  int dy = Mouse.getDY();
  int dw = Mouse.getDWheel();
  // get out if no movement
  if (dx == dy && dx == 0 && dw == 0) {
    return;
  }
  //LWJGL: 0=left 1=right 2=middle
  //GL: 0=left 1=middle 2=right
  
  int mode = 0;
  if (Mouse.isButtonDown(0)) mode |= 1; 
  if (Mouse.isButtonDown(2)) mode |= 2; 
  if (Mouse.isButtonDown(1)) mode |= 4;
  if (mode != 0) {
    //LWJGL has inverted dy wrt C++/GL
    dsMotion (mode, dx, -dy);
  }
  
}

代码示例来源:origin: TehNut/HWYLA

public MouseEvent(IWidget widget) {
  this.srcwidget = widget;
  this.timestamp = System.nanoTime();
  this.mc = Minecraft.getMinecraft();
  this.x = (double) Mouse.getEventX() * (double) this.srcwidget.getSize().getX() / (double) this.mc.displayWidth;
  this.y = (double) this.srcwidget.getSize().getY() - (double) Mouse.getEventY() * (double) this.srcwidget.getSize().getY() / (double) this.mc.displayHeight - 1.0;
  //this.x = Mouse.getEventX();
  //this.y = Mouse.getEventY();
  //System.out.printf("%s %s\n", this.x, this.y);
  //this.z = Mouse.getEventDWheel();
  this.z = Mouse.getDWheel();
  for (int i = 0; i < buttonCount; i++)
    buttonState[i] = Mouse.isButtonDown(i);
  this.trgwidget = this.srcwidget.getWidgetAtCoordinates(this.x, this.y);
}

代码示例来源:origin: iLexiconn/LLibrary

@Override
public final void drawScreen(int mouseX, int mouseY, float partialTicks) {
  Gui.drawRect(0, 0, this.width, this.height, LLibrary.CONFIG.getTertiaryColor());
  float preciseMouseX = this.getPreciseMouseX();
  float preciseMouseY = this.getPreciseMouseY();
  this.drawScreen(preciseMouseX, preciseMouseY, partialTicks);
  synchronized (this.elementLock) {
    this.elements.forEach(element -> this.renderElement(element, preciseMouseX, preciseMouseY, partialTicks));
  }
  int scrollAmount = Mouse.getDWheel();
  if (scrollAmount != 0) {
    for (Element element : this.getPostOrderElements()) {
      if (element.isVisible() && element.isEnabled()) {
        if (element.mouseScrolled(preciseMouseX, preciseMouseY, scrollAmount)) {
          return;
        }
      }
    }
  }
}

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

@Override
public void handleMouseInputSub() throws IOException {
  int wheel = org.lwjgl.input.Mouse.getDWheel() / 120;
  if (wheel == 0) {
    super.handleMouseInputSub();
  }
  if(compiler.getCurrentTask() == null) {
    if (categoryTextList.getSize() == 0 && programTextList.getSize() != 0) {
      if (wheel < 0) {
        programListLarge.mouseScrollUp();
      } else if (wheel > 0) {
        programListLarge.mouseScrollDown();
      }
    } else {
      if (wheel < 0) {
        categoryList.mouseScrollUp();
        programList.mouseScrollUp();
      } else if (wheel > 0) {
        categoryList.mouseScrollDown();
        programList.mouseScrollDown();
      }
    }
  }
}

相关文章