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

The following examples show how to use org.lwjgl.input.Mouse#hasWheel() . 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 vote down vote up
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 vote down vote up
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 vote down vote up
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: GuiTextArea.java    From pycode-minecraft with 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);
        }
    }
}