Java Code Examples for org.lwjgl.input.Mouse#getDWheel()
The following examples show how to use
org.lwjgl.input.Mouse#getDWheel() .
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: OverViewComponent.java From seppuku with GNU General Public License v3.0 | 6 votes |
private void handleScrolling(int mouseX, int mouseY) { final boolean inside = mouseX >= this.getX() && mouseX <= this.getX() + this.getW() && mouseY >= this.getY() && mouseY <= this.getY() + this.getH(); if (inside && Mouse.hasWheel()) { this.scroll += -(Mouse.getDWheel() / 100); if (this.scroll <= 0) { this.scroll = 0; } if (this.scroll >= 10) { this.scroll = 10; } if (this.lastScroll != this.scroll) { this.lastScroll = this.scroll; this.distance = this.scroll * 10; //TODO update fbo } } }
Example 2
Source File: ModuleListComponent.java From seppuku with GNU General Public License v3.0 | 5 votes |
private void handleScrolling(int mouseX, int mouseY) { final boolean inside = mouseX >= this.getX() && mouseX <= this.getX() + this.getW() && mouseY >= this.getY() && mouseY <= this.getY() + this.getH(); if (inside && Mouse.hasWheel()) { this.scroll += -(Mouse.getDWheel() / 10); if (this.scroll < 0) { this.scroll = 0; } if (this.scroll > this.totalHeight - this.getH()) { this.scroll = this.totalHeight - (int) this.getH(); } } }
Example 3
Source File: HubComponent.java From seppuku with GNU General Public License v3.0 | 5 votes |
private void handleScrolling(int mouseX, int mouseY) { final boolean inside = mouseX >= this.getX() && mouseX <= this.getX() + this.getW() && mouseY >= this.getY() && mouseY <= this.getY() + this.getH(); if (inside && Mouse.hasWheel()) { this.scroll += -(Mouse.getDWheel() / 10); if (this.scroll < 0) { this.scroll = 0; } if (this.scroll > this.totalHeight - this.getH()) { this.scroll = this.totalHeight - (int) this.getH(); } } }
Example 4
Source File: GuiCustomCrosshairEditCrosshair.java From Hyperium with GNU Lesser General Public License v3.0 | 5 votes |
public void updateScreen() { final int wheel = Mouse.getDWheel(); final int increment = (int) Math.ceil(scrollbar.getMaxValue() / 10); if (wheel > 0) { scrollbar.setValue(scrollbar.getValue() - increment); } if (wheel < 0) { scrollbar.setValue(scrollbar.getValue() + increment); } super.updateScreen(); }
Example 5
Source File: Camera.java From LowPolyWater with The Unlicense | 5 votes |
private void calculateZoom() { float targetZoom = distanceFromPlayer.getTarget(); float zoomLevel = Mouse.getDWheel() * 0.0008f * targetZoom; targetZoom -= zoomLevel; if (targetZoom < 1) { targetZoom = 1; } distanceFromPlayer.setTarget(targetZoom); distanceFromPlayer.update(0.01f); }
Example 6
Source File: GuiTextArea.java From pycode-minecraft with MIT License | 5 votes |
/** * Increments the cursor counter and mouse scroll */ public void update() { // only interested in up to 12 ticks this.cursorCounter = (this.cursorCounter + 1) % 12; if (this.isFocused && Mouse.hasWheel()) { int newScroll = Mouse.getDWheel(); if (newScroll != 0) { this.scrollBy(newScroll); } } }
Example 7
Source File: WidgetVerticalScrollbar.java From PneumaticCraft with GNU General Public License v3.0 | 5 votes |
@Override public void handleMouseInput(){ if(listening) { int wheel = -Mouse.getDWheel(); wheel = MathHelper.clamp_int(wheel, -1, 1); currentScroll += (float)wheel / states; } }
Example 8
Source File: GuiTerminalFluid.java From ExtraCells1 with MIT License | 4 votes |
@Override public void initGui() { super.initGui(); fluidWidgets = new ArrayList<AbstractFluidWidget>(); Mouse.getDWheel(); List<Fluid> selectorFluids = new ArrayList<Fluid>(); for (SpecialFluidStack stack : oldFluids) { fluidWidgets.add(new WidgetFluidSelector(this, stack)); selectorFluids.add(stack.getFluidStack().getFluid()); } for (Fluid fluid : oldCraftables) if (!selectorFluids.contains(fluid)) fluidWidgets.add(new WidgetFluidRequest(this, fluid)); for (AbstractFluidWidget widget : fluidWidgets) { if (widget instanceof WidgetFluidSelector && widget.getFluid() == oldSelected) { WidgetFluidSelector selector = (WidgetFluidSelector) widget; selector.setSelected(true); updateSelected(selector); } } Collections.sort(fluidWidgets, new FluidWidgetComparator()); searchbar = new GuiTextField(fontRenderer, guiLeft + 81, guiTop - 12, 88, 10) { private int xPos = 0; private int yPos = 0; private int width = 0; private int height = 0; public void mouseClicked(int x, int y, int mouseBtn) { boolean flag = x >= xPos && x < xPos + width && y >= yPos && y < yPos + height; if (flag && mouseBtn == 3) setText(""); } }; searchbar.setEnableBackgroundDrawing(false); searchbar.setFocused(true); searchbar.setMaxStringLength(15); }