本文整理了Java中org.lwjgl.input.Mouse.getEventX()
方法的一些代码示例,展示了Mouse.getEventX()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Mouse.getEventX()
方法的具体详情如下:
包路径:org.lwjgl.input.Mouse
类名称:Mouse
方法名:getEventX
暂无
代码示例来源:origin: libgdx/libgdx
while (Mouse.next()) {
events++;
int x = (int)(Mouse.getEventX() * Display.getPixelScaleFactor());
int y = Gdx.graphics.getHeight() - (int)(Mouse.getEventY() * Display.getPixelScaleFactor()) - 1;
int button = Mouse.getEventButton();
代码示例来源:origin: libgdx/libgdx
while (Mouse.next()) {
events++;
int x = (int)(Mouse.getEventX() * Display.getPixelScaleFactor());
int y = Gdx.graphics.getHeight() - (int)(Mouse.getEventY() * Display.getPixelScaleFactor()) - 1;
int button = Mouse.getEventButton();
代码示例来源: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: PrinceOfAmber/Cyclic
@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;
soundList.handleMouseInput(mouseX, mouseY);
}
代码示例来源: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: 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: thraaawn/CompactMachines
@Override
public void handleMouseInput() throws IOException {
super.handleMouseInput();
if(activeTab == 1) {
int mouseX = Mouse.getEventX() * this.width / this.mc.displayWidth;
int mouseY = this.height - Mouse.getEventY() * this.height / this.mc.displayHeight - 1;
if (this.guiWhiteList != null) {
this.guiWhiteList.handleMouseInput(mouseX, mouseY);
}
}
}
代码示例来源:origin: SquidDev-CC/plethora
@Override
public void handleMouseInput() throws IOException {
super.handleMouseInput();
int x = Mouse.getEventX() * width / mc.displayWidth;
int y = height - Mouse.getEventY() * height / mc.displayHeight - 1;
terminalGui.handleMouseInput(x, y);
}
代码示例来源: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: McJtyMods/XNet
@Override
protected void drawStackTooltips(int mouseX, int mouseY) {
int x = Mouse.getEventX() * width / mc.displayWidth;
int y = height - Mouse.getEventY() * height / mc.displayHeight - 1;
Widget<?> widget = window.getToplevel().getWidgetAtPosition(x, y);
if (widget instanceof BlockRender) {
if ("block".equals(widget.getUserObject())) {
//System.out.println("GuiController.drawStackTooltips");
return; // Don't do the normal tooltip rendering
}
}
super.drawStackTooltips(mouseX, mouseY);
}
}
代码示例来源:origin: Vazkii/Psi
@Override
public void handleMouseInput() throws IOException {
int mouseX = Mouse.getEventX() * width / mc.displayWidth;
int mouseY = height - Mouse.getEventY() * height / mc.displayHeight - 1;
super.handleMouseInput();
if(listText != null)
listText.handleMouseInput(mouseX, mouseY);
listGroups.handleMouseInput(mouseX, mouseY);
}
代码示例来源:origin: SleepyTrousers/EnderCore
@Override
protected boolean isPointInRegion(int p_146978_1_, int p_146978_2_, int p_146978_3_, int p_146978_4_, int p_146978_5_, int p_146978_6_) {
int x = Mouse.getEventX() * this.width / this.mc.displayWidth;
int y = this.height - Mouse.getEventY() * this.height / this.mc.displayHeight - 1;
for (IGuiOverlay overlay : overlays) {
if (overlay != null && overlay.isVisible() && overlay.isMouseInBounds(x, y)) {
return false;
}
}
return super.isPointInRegion(p_146978_1_, p_146978_2_, p_146978_3_, p_146978_4_, p_146978_5_, p_146978_6_);
}
代码示例来源: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: mezz/JustEnoughItems
@SubscribeEvent
public void onGuiMouseEvent(GuiScreenEvent.MouseInputEvent.Pre event) {
GuiScreen guiScreen = event.getGui();
int x = Mouse.getEventX() * guiScreen.width / guiScreen.mc.displayWidth;
int y = guiScreen.height - Mouse.getEventY() * guiScreen.height / guiScreen.mc.displayHeight - 1;
if (handleMouseEvent(guiScreen, x, y)) {
event.setCanceled(true);
}
}
代码示例来源: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: 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: 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);
}
}
代码示例来源: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);
}
内容来源于网络,如有侵权,请联系作者删除!