Java Code Examples for org.lwjgl.input.Mouse#getEventDWheel()

The following examples show how to use org.lwjgl.input.Mouse#getEventDWheel() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: NameHistoryGui.java    From Hyperium with GNU Lesser General Public License v3.0 6 votes vote down vote up
@Override
public void handleMouseInput() throws IOException {
    super.handleMouseInput();
    int i = Mouse.getEventDWheel();
    if (i < 0) {
        // works out length of scrollable area
        int length = height / 5 - (int) (names.size() * fontRenderer.getHeight("s"));

        if (offset - length + 1 > -names.size() && length <= names.size()) {
            // regions it cant exceed
            offset -= 10;
        }
    } else if (i > 0 && offset < 0) {
        offset += 10;
    }
}
 
Example 2
Source File: GuiJSU.java    From enderutilities with GNU Lesser General Public License v3.0 6 votes vote down vote up
@Override
public void handleMouseInput() throws IOException
{
    int mouseX = Mouse.getEventX() * this.width / this.mc.displayWidth - this.guiLeft;
    int mouseY = this.height - Mouse.getEventY() * this.height / this.mc.displayHeight - 1 - this.guiTop;

    if (Mouse.getEventDWheel() != 0 && this.areaInventory.isMouseOver(mouseX, mouseY))
    {
        this.scrollBar.handleMouseInput(mouseX, mouseY);
    }
    else if ((Mouse.getEventButton() != 0 && Mouse.isButtonDown(0) == false) ||
            this.scrollBar.handleMouseInput(mouseX, mouseY) == false)
    {
        super.handleMouseInput();
    }
}
 
Example 3
Source File: HyperiumOverlay.java    From Hyperium with GNU Lesser General Public License v3.0 6 votes vote down vote up
public void handleMouseInput() {
    ScaledResolution sr = ResolutionUtil.current();
    int sw = sr.getScaledWidth();
    int sh = sr.getScaledHeight();
    int mx = Mouse.getX() * sw / Minecraft.getMinecraft().displayWidth;
    int my = sh - Mouse.getY() * sh / Minecraft.getMinecraft().displayHeight - 1;

    Integer[] counter = new Integer[]{0};

    components.forEach(c -> c.handleMouseInput(mx, my, sr.getScaledWidth() / 6 * 2,
        sr.getScaledHeight() / 4 + 20 * counter[0]++ + offsetY, sr.getScaledWidth() / 6 * 2, 20));

    int i = Mouse.getEventDWheel();
    if (i > 0 && offsetY != 0) offsetY += 5;
    else if (i < 0) offsetY -= 5;
}
 
Example 4
Source File: GuiWindowMod.java    From ForgeHax with MIT License 6 votes vote down vote up
public void handleMouseInput() throws IOException {
  int i = Mouse.getEventDWheel();
  
  i = MathHelper.clamp(i, -1, 1);
  buttonListOffset -= i * 10;
  
  if (buttonListOffset < 0) {
    buttonListOffset = 0; // dont scroll up if its already at the top
  }
  
  int lowestButtonY = (GuiButton.height + 1) * buttonList.size() + windowY;
  int lowestAllowedOffset = lowestButtonY - height - windowY + 3;
  if (lowestButtonY - buttonListOffset < bottomY) {
    buttonListOffset = lowestAllowedOffset;
  }
}
 
Example 5
Source File: GuiEnderUtilities.java    From enderutilities with GNU Lesser General Public License v3.0 6 votes vote down vote up
@Override
public void handleMouseInput() throws IOException
{
    int dWheel = Mouse.getEventDWheel();

    if (dWheel != 0)
    {
        int mouseX = Mouse.getEventX() * this.width / this.mc.displayWidth;
        int mouseY = this.height - Mouse.getEventY() * this.height / this.mc.displayHeight - 1;

        for (int i = 0; i < this.buttonList.size(); i++)
        {
            GuiButton button = this.buttonList.get(i);

            if (button.mousePressed(this.mc, mouseX, mouseY))
            {
                this.actionPerformedWithButton(button, 10 + dWheel / 120);
                break;
            }
        }
    }
    else
    {
        super.handleMouseInput();
    }
}
 
Example 6
Source File: GuiCapture.java    From OpenPeripheral-Addons with MIT License 5 votes vote down vote up
@Override
public void handleMouseInput() {
	super.handleMouseInput();

	final int button = Mouse.getEventButton();
	final int wheel = Mouse.getEventDWheel();
	final int mx = Mouse.getEventX();
	final int my = Mouse.getEventY();

	final float scaleX = (float)this.width / this.mc.displayWidth;
	final float scaleY = (float)this.height / this.mc.displayHeight;

	final float x = mx * scaleX;
	final float y = this.height - my * scaleY;

	if (button != -1 || wheel != 0) {
		final ScaledResolution resolution = new ScaledResolution(this.mc, this.mc.displayWidth, this.mc.displayHeight);
		final DrawableHitInfo hit = TerminalManagerClient.instance.findDrawableHit(guid, resolution, x, y);

		if (button != -1) {
			final boolean state = Mouse.getEventButtonState();
			createMouseButtonEvent(button, state, hit).sendToServer();
			final boolean draggingStarted = updateButtonCounter(state);
			if (draggingStarted) resetDraggingLimiter(x, y);
		}

		if (wheel != 0) createMouseWheelEvent(wheel, hit).sendToServer();
	}

	{
		final float dx = (x - lastDragX);
		final float dy = (y - lastDragY);

		if (canSendDragEvent(dx, dy)) {
			createDragEvent(dx, dy).sendToServer();
			resetDraggingLimiter(x, y);
		}
	}

}
 
Example 7
Source File: GuiScreenWidget.java    From CodeChickenCore with MIT License 5 votes vote down vote up
@Override
public void handleMouseInput() throws IOException {
    super.handleMouseInput();
    int i = Mouse.getEventDWheel();
    if (i != 0) {
        Point p = GuiDraw.getMousePosition();
        int scroll = i > 0 ? 1 : -1;
        for (GuiWidget widget : widgets)
            widget.mouseScrolled(p.x, p.y, scroll);
    }
}
 
Example 8
Source File: GuiSearcher.java    From PneumaticCraft with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Handles mouse input.
 */
@Override
public void handleMouseInput(){
    super.handleMouseInput();
    int i = Mouse.getEventDWheel();

    if(i != 0 && needsScrollBars()) {
        int j = ((ContainerSearcher)inventorySlots).itemList.size() / 9 - 5 + 1;

        if(i > 0) {
            i = 1;
        }

        if(i < 0) {
            i = -1;
        }

        currentScroll = (float)(currentScroll - (double)i / (double)j);

        if(currentScroll < 0.0F) {
            currentScroll = 0.0F;
        }

        if(currentScroll > 1.0F) {
            currentScroll = 1.0F;
        }

        ((ContainerSearcher)inventorySlots).scrollTo(currentScroll);
    }
}
 
Example 9
Source File: MwGui.java    From mapwriter with MIT License 5 votes vote down vote up
@Override
public void handleMouseInput() {
	if (MwAPI.getCurrentDataProvider() != null && MwAPI.getCurrentDataProvider().onMouseInput(this.mapView, this.mapMode))
		return;
	
	int x = Mouse.getEventX() * this.width / this.mc.displayWidth;
    int y = this.height - Mouse.getEventY() * this.height / this.mc.displayHeight - 1;
	int direction = Mouse.getEventDWheel();
	if (direction != 0) {
		this.mouseDWheelScrolled(x, y, direction);
	}
	super.handleMouseInput();
}
 
Example 10
Source File: ModularUIGui.java    From GregTech with GNU Lesser General Public License v3.0 5 votes vote down vote up
@Override
public void handleMouseInput() throws IOException {
    super.handleMouseInput();
    int wheelMovement = Mouse.getEventDWheel();
    if (wheelMovement != 0) {
        int mouseX = Mouse.getEventX() * this.width / this.mc.displayWidth;
        int mouseY = this.height - Mouse.getEventY() * this.height / this.mc.displayHeight - 1;
        mouseWheelMove(mouseX - guiLeft, mouseY, wheelMovement);
    }
}
 
Example 11
Source File: GuiList.java    From The-5zig-Mod with MIT License 4 votes vote down vote up
@Override
public void handleMouseInput() {
	if (this.g(getMouseY())) {
		if (Mouse.isButtonDown(0) && this.q()) {
			if (this.l == -1.0F) {
				boolean var1 = true;
				if (this.j >= this.d && this.j <= this.e) {
					int x1, x2;
					if (leftbound) {
						x1 = getLeft();
						x2 = getLeft() + getRowWidth();
					} else {
						x1 = (getWidth() - getRowWidth()) / 2;
						x2 = (getWidth() + getRowWidth()) / 2;
					}
					int var4 = getMouseY() - getTop() - this.t + (int) getCurrentScroll();
					int var5 = -1;
					for (int i1 = 0; i1 < heightMap.size(); i1++) {
						Integer integer = heightMap.get(i1);
						Row line = rows.get(i1);
						if (var4 >= integer && var4 <= integer + line.getLineHeight()) {
							var5 = i1;
							break;
						}
					}
					if (getMouseX() >= x1 && getMouseX() <= x2 && var5 >= 0 && var4 >= 0 && var5 < this.b()) {
						boolean var6 = var5 == this.o && MinecraftFactory.getVars().getSystemTime() - this.p < 250L;
						this.a(var5, var6, getMouseX(), getMouseY());
						this.o = var5;
						this.p = MinecraftFactory.getVars().getSystemTime();
					} else if (getMouseX() >= x1 && getMouseX() <= x2 && var4 < 0) {
						this.a(getMouseX() - x1, getMouseY() - this.d + (int) this.n - 4);
						var1 = false;
					}

					int var11 = this.d();
					int var7 = var11 + 6;
					if (getMouseX() >= var11 && getMouseX() <= var7) {
						this.m = -1.0F;
						int var8 = this.m();
						if (var8 < 1) {
							var8 = 1;
						}

						int var9 = (int) ((float) ((this.e - this.d) * (this.e - this.d)) / (float) this.k());
						var9 = rk.a(var9, 32, this.e - this.d - 8);
						this.m /= (float) (this.e - this.d - var9) / (float) var8;
					} else {
						this.m = 1.0F;
					}

					if (var1) {
						this.l = getMouseY();
					} else {
						this.l = -2;
					}
				} else {
					this.l = -2;
				}
			} else if (this.l >= 0.0F) {
				this.n -= ((float) getMouseY() - this.l) * this.m;
				this.l = getMouseY();
			}
		} else {
			this.l = -1;
		}

		int var10 = Mouse.getEventDWheel();
		if (var10 != 0) {
			if (var10 > 0) {
				var10 = -1;
			} else if (var10 < 0) {
				var10 = 1;
			}

			this.n += (float) (var10 * 18);
		}
	}
}
 
Example 12
Source File: GuiContainerManager.java    From NotEnoughItems with MIT License 4 votes vote down vote up
/**
 * Called from handleMouseInput
 */
public void handleMouseWheel() {
    int i = Mouse.getEventDWheel();
    if (i != 0)
        mouseScrolled(i > 0 ? 1 : -1);
}
 
Example 13
Source File: GuiList.java    From The-5zig-Mod with MIT License 4 votes vote down vote up
@Override
public void handleMouseInput() {
	if (this.g(getMouseY())) {
		if (Mouse.isButtonDown(0) && this.q()) {
			if (this.l == -1.0F) {
				boolean var1 = true;
				if (this.j >= this.d && this.j <= this.e) {
					int x1, x2;
					if (leftbound) {
						x1 = getLeft();
						x2 = getLeft() + getRowWidth();
					} else {
						x1 = (getWidth() - getRowWidth()) / 2;
						x2 = (getWidth() + getRowWidth()) / 2;
					}
					int var4 = getMouseY() - getTop() - this.t + (int) getCurrentScroll();
					int var5 = -1;
					for (int i1 = 0; i1 < heightMap.size(); i1++) {
						Integer integer = heightMap.get(i1);
						Row line = rows.get(i1);
						if (var4 >= integer && var4 <= integer + line.getLineHeight()) {
							var5 = i1;
							break;
						}
					}
					if (getMouseX() >= x1 && getMouseX() <= x2 && var5 >= 0 && var4 >= 0 && var5 < this.b()) {
						boolean var6 = var5 == this.o && MinecraftFactory.getVars().getSystemTime() - this.p < 250L;
						this.a(var5, var6, getMouseX(), getMouseY());
						this.o = var5;
						this.p = MinecraftFactory.getVars().getSystemTime();
					} else if (getMouseX() >= x1 && getMouseX() <= x2 && var4 < 0) {
						this.a(getMouseX() - x1, getMouseY() - this.d + (int) this.n - 4);
						var1 = false;
					}

					int var11 = this.d();
					int var7 = var11 + 6;
					if (getMouseX() >= var11 && getMouseX() <= var7) {
						this.m = -1.0F;
						int var8 = this.m();
						if (var8 < 1) {
							var8 = 1;
						}

						int var9 = (int) ((float) ((this.e - this.d) * (this.e - this.d)) / (float) this.k());
						var9 = op.a(var9, 32, this.e - this.d - 8);
						this.m /= (float) (this.e - this.d - var9) / (float) var8;
					} else {
						this.m = 1.0F;
					}

					if (var1) {
						this.l = getMouseY();
					} else {
						this.l = -2;
					}
				} else {
					this.l = -2;
				}
			} else if (this.l >= 0.0F) {
				this.n -= ((float) getMouseY() - this.l) * this.m;
				this.l = getMouseY();
			}
		} else {
			this.l = -1;
		}

		int var10 = Mouse.getEventDWheel();
		if (var10 != 0) {
			if (var10 > 0) {
				var10 = -1;
			} else if (var10 < 0) {
				var10 = 1;
			}

			this.n += (float) (var10 * 18);
		}
	}
}
 
Example 14
Source File: GuiList.java    From The-5zig-Mod with MIT License 4 votes vote down vote up
@Override
public void handleMouseInput() {
	if (this.g(getMouseY())) {
		if (Mouse.isButtonDown(0) && this.q()) {
			if (this.l == -1.0F) {
				boolean var1 = true;
				if (this.j >= this.d && this.j <= this.e) {
					int x1, x2;
					if (leftbound) {
						x1 = getLeft();
						x2 = getLeft() + getRowWidth();
					} else {
						x1 = (getWidth() - getRowWidth()) / 2;
						x2 = (getWidth() + getRowWidth()) / 2;
					}
					int var4 = getMouseY() - getTop() - this.t + (int) getCurrentScroll();
					int var5 = -1;
					for (int i1 = 0; i1 < heightMap.size(); i1++) {
						Integer integer = heightMap.get(i1);
						Row line = rows.get(i1);
						if (var4 >= integer && var4 <= integer + line.getLineHeight()) {
							var5 = i1;
							break;
						}
					}
					if (getMouseX() >= x1 && getMouseX() <= x2 && var5 >= 0 && var4 >= 0 && var5 < this.b()) {
						boolean var6 = var5 == this.o && MinecraftFactory.getVars().getSystemTime() - this.p < 250L;
						this.a(var5, var6, getMouseX(), getMouseY());
						this.o = var5;
						this.p = MinecraftFactory.getVars().getSystemTime();
					} else if (getMouseX() >= x1 && getMouseX() <= x2 && var4 < 0) {
						this.a(getMouseX() - x1, getMouseY() - this.d + (int) this.n - 4);
						var1 = false;
					}

					int var11 = this.d();
					int var7 = var11 + 6;
					if (getMouseX() >= var11 && getMouseX() <= var7) {
						this.m = -1.0F;
						int var8 = this.m();
						if (var8 < 1) {
							var8 = 1;
						}

						int var9 = (int) ((float) ((this.e - this.d) * (this.e - this.d)) / (float) this.k());
						var9 = op.a(var9, 32, this.e - this.d - 8);
						this.m /= (float) (this.e - this.d - var9) / (float) var8;
					} else {
						this.m = 1.0F;
					}

					if (var1) {
						this.l = getMouseY();
					} else {
						this.l = -2;
					}
				} else {
					this.l = -2;
				}
			} else if (this.l >= 0.0F) {
				this.n -= ((float) getMouseY() - this.l) * this.m;
				this.l = getMouseY();
			}
		} else {
			this.l = -1;
		}

		int var10 = Mouse.getEventDWheel();
		if (var10 != 0) {
			if (var10 > 0) {
				var10 = -1;
			} else if (var10 < 0) {
				var10 = 1;
			}

			this.n += (float) (var10 * 18);
		}
	}
}
 
Example 15
Source File: GuiList.java    From The-5zig-Mod with MIT License 4 votes vote down vote up
@Override
public void handleMouseInput() {
	if (this.g(getMouseY())) {
		if (Mouse.isButtonDown(0) && this.q()) {
			if (this.l == -1.0F) {
				boolean var1 = true;
				if (this.j >= this.d && this.j <= this.e) {
					int x1, x2;
					if (leftbound) {
						x1 = getLeft();
						x2 = getLeft() + getRowWidth();
					} else {
						x1 = (getWidth() - getRowWidth()) / 2;
						x2 = (getWidth() + getRowWidth()) / 2;
					}
					int var4 = getMouseY() - getTop() - this.t + (int) getCurrentScroll();
					int var5 = -1;
					for (int i1 = 0; i1 < heightMap.size(); i1++) {
						Integer integer = heightMap.get(i1);
						Row line = rows.get(i1);
						if (var4 >= integer && var4 <= integer + line.getLineHeight()) {
							var5 = i1;
							break;
						}
					}
					if (getMouseX() >= x1 && getMouseX() <= x2 && var5 >= 0 && var4 >= 0 && var5 < this.b()) {
						boolean var6 = var5 == this.o && MinecraftFactory.getVars().getSystemTime() - this.p < 250L;
						this.a(var5, var6, getMouseX(), getMouseY());
						this.o = var5;
						this.p = MinecraftFactory.getVars().getSystemTime();
					} else if (getMouseX() >= x1 && getMouseX() <= x2 && var4 < 0) {
						this.a(getMouseX() - x1, getMouseY() - this.d + (int) this.n - 4);
						var1 = false;
					}

					int var11 = this.d();
					int var7 = var11 + 6;
					if (getMouseX() >= var11 && getMouseX() <= var7) {
						this.m = -1.0F;
						int var8 = this.m();
						if (var8 < 1) {
							var8 = 1;
						}

						int var9 = (int) ((float) ((this.e - this.d) * (this.e - this.d)) / (float) this.k());
						var9 = ot.a(var9, 32, this.e - this.d - 8);
						this.m /= (float) (this.e - this.d - var9) / (float) var8;
					} else {
						this.m = 1.0F;
					}

					if (var1) {
						this.l = getMouseY();
					} else {
						this.l = -2;
					}
				} else {
					this.l = -2;
				}
			} else if (this.l >= 0.0F) {
				this.n -= ((float) getMouseY() - this.l) * this.m;
				this.l = getMouseY();
			}
		} else {
			this.l = -1;
		}

		int var10 = Mouse.getEventDWheel();
		if (var10 != 0) {
			if (var10 > 0) {
				var10 = -1;
			} else if (var10 < 0) {
				var10 = 1;
			}

			this.n += (float) (var10 * 18);
		}
	}
}
 
Example 16
Source File: GuiList.java    From The-5zig-Mod with MIT License 4 votes vote down vote up
@Override
public void handleMouseInput() {
	if (this.g(getMouseY())) {
		if (Mouse.isButtonDown(0) && this.q()) {
			if (this.l == -1.0F) {
				boolean var1 = true;
				if (this.j >= this.d && this.j <= this.e) {
					int x1, x2;
					if (leftbound) {
						x1 = getLeft();
						x2 = getLeft() + getRowWidth();
					} else {
						x1 = (getWidth() - getRowWidth()) / 2;
						x2 = (getWidth() + getRowWidth()) / 2;
					}
					int var4 = getMouseY() - getTop() - this.t + (int) getCurrentScroll();
					int var5 = -1;
					for (int i1 = 0; i1 < heightMap.size(); i1++) {
						Integer integer = heightMap.get(i1);
						Row line = rows.get(i1);
						if (var4 >= integer && var4 <= integer + line.getLineHeight()) {
							var5 = i1;
							break;
						}
					}
					if (getMouseX() >= x1 && getMouseX() <= x2 && var5 >= 0 && var4 >= 0 && var5 < this.b()) {
						boolean var6 = var5 == this.o && MinecraftFactory.getVars().getSystemTime() - this.p < 250L;
						this.a(var5, var6, getMouseX(), getMouseY());
						this.o = var5;
						this.p = MinecraftFactory.getVars().getSystemTime();
					} else if (getMouseX() >= x1 && getMouseX() <= x2 && var4 < 0) {
						this.a(getMouseX() - x1, getMouseY() - this.d + (int) this.n - 4);
						var1 = false;
					}

					int var11 = this.d();
					int var7 = var11 + 6;
					if (getMouseX() >= var11 && getMouseX() <= var7) {
						this.m = -1.0F;
						int var8 = this.m();
						if (var8 < 1) {
							var8 = 1;
						}

						int var9 = (int) ((float) ((this.e - this.d) * (this.e - this.d)) / (float) this.k());
						var9 = ri.a(var9, 32, this.e - this.d - 8);
						this.m /= (float) (this.e - this.d - var9) / (float) var8;
					} else {
						this.m = 1.0F;
					}

					if (var1) {
						this.l = getMouseY();
					} else {
						this.l = -2;
					}
				} else {
					this.l = -2;
				}
			} else if (this.l >= 0.0F) {
				this.n -= ((float) getMouseY() - this.l) * this.m;
				this.l = getMouseY();
			}
		} else {
			this.l = -1;
		}

		int var10 = Mouse.getEventDWheel();
		if (var10 != 0) {
			if (var10 > 0) {
				var10 = -1;
			} else if (var10 < 0) {
				var10 = 1;
			}

			this.n += (float) (var10 * 18);
		}
	}
}
 
Example 17
Source File: GuiList.java    From The-5zig-Mod with MIT License 4 votes vote down vote up
@Override
public void handleMouseInput() {
	if (this.f(getMouseY())) {
		if (Mouse.isButtonDown(0) && this.q()) {
			if (this.l == -1.0F) {
				boolean var1 = true;
				if (this.j >= this.d && this.j <= this.e) {
					int x1, x2;
					if (leftbound) {
						x1 = getLeft();
						x2 = getLeft() + getRowWidth();
					} else {
						x1 = (getWidth() - getRowWidth()) / 2;
						x2 = (getWidth() + getRowWidth()) / 2;
					}
					int var4 = getMouseY() - getTop() - this.t + (int) getCurrentScroll();
					int var5 = -1;
					for (int i1 = 0; i1 < heightMap.size(); i1++) {
						Integer integer = heightMap.get(i1);
						Row line = rows.get(i1);
						if (var4 >= integer && var4 <= integer + line.getLineHeight()) {
							var5 = i1;
							break;
						}
					}
					if (getMouseX() >= x1 && getMouseX() <= x2 && var5 >= 0 && var4 >= 0 && var5 < this.b()) {
						boolean var6 = var5 == this.o && MinecraftFactory.getVars().getSystemTime() - this.p < 250L;
						this.a(var5, var6, getMouseX(), getMouseY());
						this.o = var5;
						this.p = MinecraftFactory.getVars().getSystemTime();
					} else if (getMouseX() >= x1 && getMouseX() <= x2 && var4 < 0) {
						this.a(getMouseX() - x1, getMouseY() - this.d + (int) this.n - 4);
						var1 = false;
					}

					int var11 = this.d();
					int var7 = var11 + 6;
					if (getMouseX() >= var11 && getMouseX() <= var7) {
						this.m = -1.0F;
						int var8 = this.m();
						if (var8 < 1) {
							var8 = 1;
						}

						int var9 = (int) ((float) ((this.e - this.d) * (this.e - this.d)) / (float) this.k());
						var9 = uv.a(var9, 32, this.e - this.d - 8);
						this.m /= (float) (this.e - this.d - var9) / (float) var8;
					} else {
						this.m = 1.0F;
					}

					if (var1) {
						this.l = getMouseY();
					} else {
						this.l = -2;
					}
				} else {
					this.l = -2;
				}
			} else if (this.l >= 0.0F) {
				this.n -= ((float) getMouseY() - this.l) * this.m;
				this.l = getMouseY();
			}
		} else {
			this.l = -1;
		}

		int var10 = Mouse.getEventDWheel();
		if (var10 != 0) {
			if (var10 > 0) {
				var10 = -1;
			} else if (var10 < 0) {
				var10 = 1;
			}

			this.n += (float) (var10 * 18);
		}
	}
}
 
Example 18
Source File: GuiList.java    From The-5zig-Mod with MIT License 4 votes vote down vote up
@Override
public void handleMouseInput() {
	if (this.g(getMouseY())) {
		if (Mouse.isButtonDown(0) && this.q()) {
			if (this.l == -1.0F) {
				boolean var1 = true;
				if (this.j >= this.d && this.j <= this.e) {
					int x1, x2;
					if (leftbound) {
						x1 = getLeft();
						x2 = getLeft() + getRowWidth();
					} else {
						x1 = (getWidth() - getRowWidth()) / 2;
						x2 = (getWidth() + getRowWidth()) / 2;
					}
					int var4 = getMouseY() - getTop() - this.t + (int) getCurrentScroll();
					int var5 = -1;
					for (int i1 = 0; i1 < heightMap.size(); i1++) {
						Integer integer = heightMap.get(i1);
						Row line = rows.get(i1);
						if (var4 >= integer && var4 <= integer + line.getLineHeight()) {
							var5 = i1;
							break;
						}
					}
					if (getMouseX() >= x1 && getMouseX() <= x2 && var5 >= 0 && var4 >= 0 && var5 < this.b()) {
						boolean var6 = var5 == this.o && MinecraftFactory.getVars().getSystemTime() - this.p < 250L;
						this.a(var5, var6, getMouseX(), getMouseY());
						this.o = var5;
						this.p = MinecraftFactory.getVars().getSystemTime();
					} else if (getMouseX() >= x1 && getMouseX() <= x2 && var4 < 0) {
						this.a(getMouseX() - x1, getMouseY() - this.d + (int) this.n - 4);
						var1 = false;
					}

					int var11 = this.d();
					int var7 = var11 + 6;
					if (getMouseX() >= var11 && getMouseX() <= var7) {
						this.m = -1.0F;
						int var8 = this.m();
						if (var8 < 1) {
							var8 = 1;
						}

						int var9 = (int) ((float) ((this.e - this.d) * (this.e - this.d)) / (float) this.k());
						var9 = on.a(var9, 32, this.e - this.d - 8);
						this.m /= (float) (this.e - this.d - var9) / (float) var8;
					} else {
						this.m = 1.0F;
					}

					if (var1) {
						this.l = getMouseY();
					} else {
						this.l = -2;
					}
				} else {
					this.l = -2;
				}
			} else if (this.l >= 0.0F) {
				this.n -= ((float) getMouseY() - this.l) * this.m;
				this.l = getMouseY();
			}
		} else {
			this.l = -1;
		}

		int var10 = Mouse.getEventDWheel();
		if (var10 != 0) {
			if (var10 > 0) {
				var10 = -1;
			} else if (var10 < 0) {
				var10 = 1;
			}

			this.n += (float) (var10 * 18);
		}
	}
}
 
Example 19
Source File: AbstractTab.java    From Hyperium with GNU Lesser General Public License v3.0 4 votes vote down vote up
/**
 * Handle Mouse Input - Handle mouse events/inputs
 */
public void handleMouseInput() {
    if (Mouse.getEventDWheel() > 0) scroll++;
    else if (Mouse.getEventDWheel() < 0) scroll--;
    if (scroll > 0) scroll = 0;
}
 
Example 20
Source File: ClickGUI.java    From ClientBase with MIT License 3 votes vote down vote up
@Override
public void handleMouseInput() throws IOException {
    super.handleMouseInput();

    int eventDWheel = Mouse.getEventDWheel();

    window.mouseWheel(eventDWheel);

}