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

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

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

Mouse.setCursorPosition介绍

暂无

代码示例

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

@Override
public void setCursorPosition (int x, int y) {
  Mouse.setCursorPosition(x, Gdx.graphics.getHeight() - 1 - y);
}

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

@Override
public void setCursorPosition (int x, int y) {
  Mouse.setCursorPosition(x, Gdx.graphics.getHeight() - 1 - y);
}

代码示例来源:origin: TeamLapen/Vampirism

/**
 * Calculates the absolute mouse coordinates from the scaled ones and sets the cursor accordingly
 *
 * @param x
 * @param y
 */
private void setAbsoluteMouse(double x, double y) {
  x = x * this.mc.displayWidth / this.width;
  y = -(y + 1 - height) * this.mc.displayHeight / height;
  Mouse.setCursorPosition((int) x, (int) y);
}

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

public void setPosition(final int x, final int y) {
  init();
  Mouse.setCursorPosition(x, y);
}

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

@Override
public void setMousePosition(final int x, final int y) {
 int viewportHeight = getViewportHeight();
 Mouse.setCursorPosition(x, viewportHeight - y);
}

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

public GuiResearchStationSelection(GuiResearchStation parent, int x, int y) {
  super(parent.getContainer(), 400, 240);
  this.parent = parent;
  Mouse.setCursorPosition(x, y);
}

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

@Override
public void setCursorPosition (int x, int y) {
  Mouse.setCursorPosition(x, Gdx.graphics.getHeight() - 1 - y);
}

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

@Override
protected boolean onGuiCloseRequested() {
  getContainer().addSlots();
  int x = Mouse.getX();
  int y = Mouse.getY();
  Minecraft.getMinecraft().displayGuiScreen(parent);
  Mouse.setCursorPosition(x, y);
  return false;
}

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

@Override
  protected void onPressed() {
    getContainer().removeSlots();
    int x = Mouse.getX();
    int y = Mouse.getY();
    Minecraft.getMinecraft().displayGuiScreen(new GuiMailboxInventorySideSetup(GuiMailboxInventory.this));
    Mouse.setCursorPosition(x, y);
  }
};

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

@Override
  protected void onPressed() {
    getContainer().removeSlots();
    int x = Mouse.getX();
    int y = Mouse.getY();
    Minecraft.getMinecraft().displayGuiScreen(new GuiMailboxNameSelect(GuiMailboxInventory.this, true));
    Mouse.setCursorPosition(x, y);
  }
};

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

@Override
  protected void onPressed() {
    getContainer().removeSlots();
    int x = Mouse.getX();
    int y = Mouse.getY();
    Minecraft.getMinecraft().displayGuiScreen(new GuiMailboxNameSelect(GuiMailboxInventory.this, false));
    Mouse.setCursorPosition(x, y);
  }
};

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

@Override
protected boolean onGuiCloseRequested() {
  getContainer().addSlots();
  getContainer().setGui(parent);
  int x = Mouse.getX();
  int y = Mouse.getY();
  Minecraft.getMinecraft().displayGuiScreen(parent);
  Mouse.setCursorPosition(x, y);
  return false;
}

代码示例来源:origin: CoFH/ThermalDynamics

@Override
public void initGui() {
  super.initGui();
  x0 = (xSize - BUTTON_WIDTH) / 2 - SLIDER_WIDTH;
  y0 = getFontRenderer().FONT_HEIGHT + 28;
  vertical = new SliderVertical(this, xSize - 6 - SLIDER_WIDTH, y0, SLIDER_WIDTH, NUM_ENTRIES * BUTTON_HEIGHT + (NUM_ENTRIES - 1) * BUTTON_OFFSET, 10);
  vertical.setVisible(false);
  addElement(vertical);
  directoryButtons = new ElementDirectoryButton[NUM_ENTRIES];
  for (int i = 0; i < NUM_ENTRIES; i++) {
    directoryButtons[i] = new ElementDirectoryButton(i, this, x0, y0);
    addElement(directoryButtons[i]);
  }
  Mouse.setCursorPosition((directoryButtons[0].getPosX() + (directoryButtons[0].getWidth() >> 1) + guiLeft) * this.mc.displayWidth / this.width, (this.height - (1 + directoryButtons[0].getPosY() + (directoryButtons[0].getHeight() >> 1) + guiTop + 1)) * this.mc.displayHeight / this.height);
  final String configText = StringHelper.localize("gui.thermaldynamics.transport.config");
  int stringWidth = getFontRenderer().getStringWidth(configText);
  buttonConfig = new ElementButtonManaged(this, xSize - 12 - stringWidth, 16, stringWidth + 8, 16, configText) {
    @Override
    public void onClick() {
      PacketTileInfo myPayload = container.transportDuct.newPacketTileInfo();
      myPayload.addByte(DuctUnitTransport.NETWORK_CONFIG);
      PacketHandler.sendToServer(myPayload);
    }
  };
  addElement(buttonConfig);
}

相关文章