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

The following examples show how to use org.lwjgl.input.Mouse#hasWheel() . These examples are extracted from open source projects. 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 want to check out the right sidebar which shows the related API usage.
Example 1
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
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
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 Project: pycode-minecraft   File: GuiTextArea.java    License: MIT License 5 votes vote down vote up
/**
 * 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);
        }
    }
}