Java Code Examples for org.lwjgl.input.Mouse.getDWheel()

The following are Jave code examples for showing how to use getDWheel() of the org.lwjgl.input.Mouse class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
Example 1
Project: Wurst-MC-1.12   File: NavigatorScreen.java   Source Code and License Vote up 6 votes
@Override
public final void updateScreen()
{
	onUpdate();
	
	// scrollbar
	if(!scrollbarLocked)
	{
		scroll += Mouse.getDWheel() / 10;
		
		if(scroll > 0)
			scroll = 0;
		else if(scroll < maxScroll)
			scroll = maxScroll;
		
		if(maxScroll == 0)
			scrollKnobPosition = 0;
		else
			scrollKnobPosition =
				(int)((height - 131) * scroll / (float)maxScroll);
		scrollKnobPosition += 2;
	}
}
 
Example 2
Project: BaseClient   File: GuiGrabber.java   Source Code and License Vote up 6 votes
public void drawScreen(int x, int y, float par3) {
    GL11.glPushMatrix();
    ScaledResolution scaledRes = new ScaledResolution(this.mc);
    float scale = (float)scaledRes.getScaleFactor() / (float)Math.pow(scaledRes.getScaleFactor(), 2.0);
    GL11.glScalef((float)scale, (float)scale, (float)scale);
    int mouseX = Mouse.getX();
    int mouseY = Display.getHeight() - Mouse.getY();
    Gui.instance.update(mouseX, mouseY);
    Gui.instance.render();
    GL11.glPopMatrix();
    if (Mouse.hasWheel()) {
        int wheel = Mouse.getDWheel();
        this.scrollVelocity = wheel < 0 ? -120 : (wheel > 0 ? 120 : 0);
    }
    Gui.instance.mouseScroll(this.scrollVelocity);
}
 
Example 3
Project: pnc-repressurized   File: WidgetVerticalScrollbar.java   Source Code and License Vote up 5 votes
@Override
public void handleMouseInput() {
    if (listening) {
        int wheel = -Mouse.getDWheel();
        wheel = MathHelper.clamp(wheel, -1, 1);
        currentScroll += (float) wheel / states;
    }
}
 
Example 4
Project: LowPolyWater   File: Camera.java   Source Code and License Vote up 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 5
Project: bit-client   File: ClickGuiDisplayer.java   Source Code and License Vote up 5 votes
public void update() {
    if (Bit.getInstance() == null) return;
    int mouseX = (Mouse.getX() / 2);
    int mouseY = ((Display.getHeight() - Mouse.getY()) / 2);
    Iterator<Window> iter = Bit.getInstance().getClickGui().getWindows().iterator();
    int wheel = Mouse.hasWheel() ? Mouse.getDWheel() : 0;
    if (Bit.getInstance().getClickGui().getTopMost() != null)
        Bit.getInstance().getClickGui().getTopMost().mouseScroll(wheel < 0 ? -1 : (wheel > 0 ? 1 : 0));
    while (iter.hasNext()) {
        Window comp = iter.next();
        comp.update(mouseX, mouseY);
    }
}
 
Example 6
Project: Elgin-Plant-Game   File: Camera.java   Source Code and License Vote up 5 votes
private void calculateZoom() {
	float zoomLevel = Mouse.getDWheel() * 0.1f;
	distanceFromPlayer -= zoomLevel;
	if (distanceFromPlayer < 12f)
		distanceFromPlayer = 12f;
	if (distanceFromPlayer > 100f)
		distanceFromPlayer = 100f;
}
 
Example 7
Project: LowPolyTerrain   File: Camera.java   Source Code and License Vote up 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 8
Project: LagGoggles   File: GuiProfile.java   Source Code and License Vote up 5 votes
@Override
public void handleMouseInput() throws IOException{
    if(startProfile.isMouseOver() && startProfile.enabled){
        int wheel = Mouse.getDWheel();
        if(wheel != 0) {
            seconds = seconds + ((wheel / 120) * 5); /* 1 Click is 120, 1 click is 5 seconds */
            seconds = Math.max(seconds, 5);
            startProfile.displayString = "Profile for " + seconds + " seconds";
        }
    }
    super.handleMouseInput();
    Mouse.getDWheel();
}
 
Example 9
Project: EcoSystem-Official   File: Camera.java   Source Code and License Vote up 5 votes
private void calculateZoom() {
    float targetZoom = distanceFromPlayer.getTarget();
    float zoomLevel = Mouse.getDWheel() * 0.0008f * targetZoom;
    targetZoom -= zoomLevel;
    if (targetZoom < 0) {
        targetZoom = 0;
    }
    //if small Terrain
    if (Configs.TERRAIN_SIZE <= 100) {
        if (targetZoom > 35) {
            targetZoom = 35;
        }
    }
    //if medium terrain
    else if (Configs.TERRAIN_SIZE <= 200) {
        if (targetZoom > 75) {
            targetZoom = 75;
        }
    }
    //if large terrain
    else if (Configs.TERRAIN_SIZE >= 300) {
        if (targetZoom > 100) {
            targetZoom = 100;
        }
    }
    //error with terrain size
    else {
        System.err.println("Mouse Zoom Control Could Not Be Performed!!");
    }
    distanceFromPlayer.setTarget(targetZoom);
    distanceFromPlayer.update(0.01f);
}
 
Example 10
Project: OcclusionQueries   File: Camera.java   Source Code and License Vote up 5 votes
private void calculateZoom(){
	float targetZoom = distanceFromPlayer.getTarget();
	float zoomLevel = Mouse.getDWheel() * 0.0008f * targetZoom;
	targetZoom -= zoomLevel;
	if(targetZoom<1){
		targetZoom = 1;
	}else if(targetZoom > 20){
		targetZoom = 20;
	}
	distanceFromPlayer.setTarget(targetZoom);
	distanceFromPlayer.update(0.01f);
}
 
Example 11
Project: BaseClient   File: AccountScreen.java   Source Code and License Vote up 4 votes
public void drawScreen(int x, int y, float par3) {
    GL11.glDisable((int)3008);
    this.renderSkybox(x, y, par3);
    GL11.glEnable((int)3008);
    int mouseX = Mouse.getEventX() * this.width / this.mc.displayWidth;
    int mouseY = this.height - Mouse.getEventY() * this.height / this.mc.displayHeight - 1;
    if (this.buttonList.size() > 0) {
        if (this.prevWidth != this.width || this.prevHeight != this.height) {
            this.initGui();
            this.prevWidth = this.width;
            this.prevHeight = this.height;
        }
        if (Mouse.hasWheel() && this.buttonList.get(this.buttonList.size() - 1).getX2() - this.buttonList.get(0).getX1() > this.width && this.currentScreen == null) {
            int wheel = Mouse.getDWheel();
            if (wheel < 0) {
                this.scrollVelocity += 8;
            } else if (wheel > 0) {
                this.scrollVelocity -= 8;
            }
            if (this.scrollVelocity > 40) {
                this.scrollVelocity = 40;
            }
            if (this.scrollVelocity < -40) {
                this.scrollVelocity = -40;
            }
            this.scrollOffset -= this.scrollVelocity;
            if (this.scrollOffset > 0 - this.scrollVelocity) {
                this.scrollOffset = 0 - this.scrollVelocity;
            }
            if (this.buttonList.get(this.buttonList.size() - 1).getX2() - this.width + 20 < 0) {
                this.scrollOffset = (this.buttonList.get(this.buttonList.size() - 1).getX2() - this.width + 20 - this.scrollOffset) * -1;
            }
        }
        if (this.scrollVelocity < 0) {
            ++this.scrollVelocity;
        } else if (this.scrollVelocity > 0) {
            --this.scrollVelocity;
        }
        this.drawAltButtons(mouseX, mouseY);
    }
    this.drawCenteredString(this.info, 1.2f, 0, 2);
    this.drawCenteredString("\u00a7b" + AccountManager.accountList.size() + " Alts", 1.0f, 0, 14);
    this.addAltButton.draw(mouseX, mouseY);
    this.delAltButton.draw(mouseX, mouseY);
    this.editAltButton.draw(mouseX, mouseY);
    this.randomAltButton.draw(mouseX, mouseY);
    if (this.currentScreen != null) {
        this.currentScreen.draw(mouseX, mouseY);
    }
}
 
Example 12
Project: EMC   File: IMouse.java   Source Code and License Vote up 4 votes
public static int getDWheel() {
	return Mouse.getDWheel();
}
 
Example 13
Project: ModularMachinery   File: GuiScreenBlueprint.java   Source Code and License Vote up 4 votes
@Override
public void drawScreen(int mouseX, int mouseY, float partialTicks) {
    super.drawScreen(mouseX, mouseY, partialTicks);
    frameCount++;

    GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
    this.mc.getTextureManager().bindTexture(TEXTURE_BACKGROUND);
    int x = (this.width - this.xSize) / 2;
    int z = (this.height - this.ySize) / 2;
    this.drawTexturedModalRect(x, z, 0, 0, this.xSize, this.ySize);

    if(renderContext.doesRenderIn3D()) {
        if (Mouse.isButtonDown(0) && frameCount > 20) {
            renderContext.rotateRender(0.25 * Mouse.getDY(), 0.25 * Mouse.getDX(), 0);
        }
    } else {
        if (Mouse.isButtonDown(0) && frameCount > 20) {
            renderContext.moveRender(0.25 * Mouse.getDX(), 0, -0.25 * Mouse.getDY());
        }
    }
    int dwheel = Mouse.getDWheel();
    if(dwheel < 0) {
        renderContext.zoomOut();
    } else if(dwheel > 0) {
        renderContext.zoomIn();
    }

    if(GameSettings.isKeyDown(Minecraft.getMinecraft().gameSettings.keyBindSneak)) {
        if(renderContext.getShiftSnap() == -1) {
            renderContext.snapSamples();
        }
    } else {
        renderContext.releaseSamples();
    }

    ScaledResolution res = new ScaledResolution(mc);
    Rectangle scissorFrame = new Rectangle((guiLeft + 8) * res.getScaleFactor(), (guiTop + 43) * res.getScaleFactor(),
            160 * res.getScaleFactor(), 94 * res.getScaleFactor());
    GL11.glEnable(GL11.GL_SCISSOR_TEST);
    GL11.glScissor(scissorFrame.x, scissorFrame.y, scissorFrame.width, scissorFrame.height);
    x = 88;
    z = 66;
    renderContext.renderAt(this.guiLeft + x, this.guiTop + z, partialTicks);
    GL11.glDisable(GL11.GL_SCISSOR_TEST);

    drawButtons(mouseX, mouseY);

    GlStateManager.disableDepth();
    fontRenderer.drawStringWithShadow(machine.getLocalizedName(), this.guiLeft + 10, this.guiTop + 11, 0xFFFFFFFF);
    if(machine.requiresBlueprint()) {
        String reqBlueprint = I18n.format("tooltip.machinery.blueprint.required");
        fontRenderer.drawString(reqBlueprint, this.guiLeft + 10, this.guiTop + 106, 0x444444);
    }
    GlStateManager.enableDepth();

    scissorFrame = new Rectangle(MathHelper.floor(this.guiLeft + 8), MathHelper.floor(this.guiTop + 8), 160, 94);
    if(!renderContext.doesRenderIn3D() && scissorFrame.contains(mouseX, mouseY)) {
        render2DHover(mouseX, mouseY, x, z);
    }
}