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

The following are Jave code examples for showing how to use getEventX() 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: GeneralLaymansAestheticSpyingScreen   File: GuiWirelessOrder.java   Source Code and License Vote up 6 votes
@Override
public void handleMouseInput() throws IOException
{
    int mouseX = Mouse.getEventX() * this.width / this.mc.displayWidth;
    int mouseY = this.height - Mouse.getEventY() * this.height / this.mc.displayHeight - 1;

    super.handleMouseInput();

    if(mouseX > guiLeft + 100 && mouseX < guiLeft + 165 && mouseY > guiTop + 5 && mouseY < guiTop + 70)
    {
        int scroll = Mouse.getEventDWheel();
        if(scroll != 0)
        {
            scale += 0.1F * (1F * scroll / 120.0F);
            if(scale < 0.1F)
            {
                scale = 0.1F;
            }
        }
    }

    this.trackList.handleMouseInput(mouseX, mouseY);
}
 
Example 2
Project: BaseClient   File: ClickGui.java   Source Code and License Vote up 6 votes
public void drawScreen(int x, int y, float par3) {
    int mouseX = Mouse.getEventX() * this.width / this.mc.displayWidth;
    int mouseY = this.height - Mouse.getEventY() * this.height / this.mc.displayHeight - 1;
    if (this.currentLayerType == Type.CATEGORY) {
        for (Button categoryButton : this.categoryList) {
            categoryButton.draw(mouseX, mouseY);
        }
    } else if (this.currentLayerType == Type.MODULE) {
        this.backButton.draw(mouseX, mouseY);
        for (Button moduleButton : this.moduleList) {
            moduleButton.draw(mouseX, mouseY);
        }
    } else if (this.currentLayerType == Type.OPTION) {
        this.backButton.draw(mouseX, mouseY);
        for (Button optionButton : this.optionList) {
            optionButton.draw(mouseX, mouseY);
        }
    } else if (this.currentLayerType == Type.SLIDER) {
        this.backButton.draw(mouseX, mouseY);
        slider.draw(mouseX, mouseY);
    }
}
 
Example 3
Project: betaexpansion   File: GuiScreen.java   Source Code and License Vote up 5 votes
public void handleMouseInput()
{
    if(Mouse.getEventButtonState())
    {
        int i = (Mouse.getEventX() * width) / mc.displayWidth;
        int k = height - (Mouse.getEventY() * height) / mc.displayHeight - 1;
        mouseClicked(i, k, Mouse.getEventButton());
    } else
    {
        int j = (Mouse.getEventX() * width) / mc.displayWidth;
        int l = height - (Mouse.getEventY() * height) / mc.displayHeight - 1;
        mouseMovedOrUp(j, l, Mouse.getEventButton());
    }
}
 
Example 4
Project: GeneralLaymansAestheticSpyingScreen   File: GuiProjectorSetter.java   Source Code and License Vote up 5 votes
@Override
public void handleMouseInput() throws IOException
{
    int mouseX = Mouse.getEventX() * this.width / this.mc.displayWidth;
    int mouseY = this.height - Mouse.getEventY() * this.height / this.mc.displayHeight - 1;

    super.handleMouseInput();
    this.trackList.handleMouseInput(mouseX, mouseY);
}
 
Example 5
Project: GeneralLaymansAestheticSpyingScreen   File: GuiChannelSetterProjector.java   Source Code and License Vote up 5 votes
@Override
public void handleMouseInput() throws IOException
{
    int mouseX = Mouse.getEventX() * this.width / this.mc.displayWidth;
    int mouseY = this.height - Mouse.getEventY() * this.height / this.mc.displayHeight - 1;

    super.handleMouseInput();
    this.trackList.handleMouseInput(mouseX, mouseY);
}
 
Example 6
Project: DankNull   File: GuiDankNull.java   Source Code and License Vote up 5 votes
@Override
public void handleMouseInput() throws IOException {
	int mouseX = Mouse.getEventX() * width / mc.displayWidth;
	int mouseY = height - Mouse.getEventY() * height / mc.displayHeight - 1;
	int button = Mouse.getEventButton();

	if (Mouse.getEventButtonState()) {
		//if (GuiScreen.isCtrlKeyDown()) {
		if (GuiScreen.isAltKeyDown()) {
			if (button == 0) {
				Slot slot = getSlotAtPos(mouseX, mouseY);
				if (slot != null && !slot.getStack().isEmpty()) {
					if (!ItemUtils.areItemsEqual(DankNullUtils.getSelectedStack(getDankNullInventory()), slot.getStack())) {
						int count = 0;
						for (Slot slotHovered : inventorySlots.inventorySlots) {
							count++;
							if (slotHovered.equals(slot)) {
								DankNullUtils.setSelectedStackIndex(getDankNullInventory(), (count - 1) - 36);
								return;
							}
						}
					}
				}
			}
			//}
		}
	}
	super.handleMouseInput();
}
 
Example 7
Project: DecompiledMinecraft   File: GuiScreen.java   Source Code and License Vote up 5 votes
/**
 * Handles mouse input.
 */
public void handleMouseInput() throws IOException
{
    int i = Mouse.getEventX() * this.width / this.mc.displayWidth;
    int j = this.height - Mouse.getEventY() * this.height / this.mc.displayHeight - 1;
    int k = Mouse.getEventButton();

    if (Mouse.getEventButtonState())
    {
        if (this.mc.gameSettings.touchscreen && this.touchValue++ > 0)
        {
            return;
        }

        this.eventButton = k;
        this.lastMouseEvent = Minecraft.getSystemTime();
        this.mouseClicked(i, j, this.eventButton);
    }
    else if (k != -1)
    {
        if (this.mc.gameSettings.touchscreen && --this.touchValue > 0)
        {
            return;
        }

        this.eventButton = -1;
        this.mouseReleased(i, j, k);
    }
    else if (this.eventButton != -1 && this.lastMouseEvent > 0L)
    {
        long l = Minecraft.getSystemTime() - this.lastMouseEvent;
        this.mouseClickMove(i, j, this.eventButton, l);
    }
}
 
Example 8
Project: BaseClient   File: GuiScreen.java   Source Code and License Vote up 5 votes
/**
 * Handles mouse input.
 */
public void handleMouseInput() throws IOException
{
    int i = Mouse.getEventX() * this.width / this.mc.displayWidth;
    int j = this.height - Mouse.getEventY() * this.height / this.mc.displayHeight - 1;
    int k = Mouse.getEventButton();

    if (Mouse.getEventButtonState())
    {
        if (this.mc.gameSettings.touchscreen && this.touchValue++ > 0)
        {
            return;
        }

        this.eventButton = k;
        this.lastMouseEvent = Minecraft.getSystemTime();
        this.mouseClicked(i, j, this.eventButton);
    }
    else if (k != -1)
    {
        if (this.mc.gameSettings.touchscreen && --this.touchValue > 0)
        {
            return;
        }

        this.eventButton = -1;
        this.mouseReleased(i, j, k);
    }
    else if (this.eventButton != -1 && this.lastMouseEvent > 0L)
    {
        long l = Minecraft.getSystemTime() - this.lastMouseEvent;
        this.mouseClickMove(i, j, this.eventButton, l);
    }
}
 
Example 9
Project: BaseClient   File: GuiScreen.java   Source Code and License Vote up 5 votes
/**
 * Handles mouse input.
 */
public void handleMouseInput() throws IOException
{
    int i = Mouse.getEventX() * this.width / this.mc.displayWidth;
    int j = this.height - Mouse.getEventY() * this.height / this.mc.displayHeight - 1;
    int k = Mouse.getEventButton();

    if (Mouse.getEventButtonState())
    {
        if (this.mc.gameSettings.touchscreen && this.touchValue++ > 0)
        {
            return;
        }

        this.eventButton = k;
        this.lastMouseEvent = Minecraft.getSystemTime();
        this.mouseClicked(i, j, this.eventButton);
    }
    else if (k != -1)
    {
        if (this.mc.gameSettings.touchscreen && --this.touchValue > 0)
        {
            return;
        }

        this.eventButton = -1;
        this.mouseReleased(i, j, k);
    }
    else if (this.eventButton != -1 && this.lastMouseEvent > 0L)
    {
        long l = Minecraft.getSystemTime() - this.lastMouseEvent;
        this.mouseClickMove(i, j, this.eventButton, l);
    }
}
 
Example 10
Project: Clef   File: GuiPlayTrack.java   Source Code and License Vote up 5 votes
@Override
public void handleMouseInput() throws IOException
{
    int mouseX = Mouse.getEventX() * this.width / this.mc.displayWidth;
    int mouseY = this.height - Mouse.getEventY() * this.height / this.mc.displayHeight - 1;

    super.handleMouseInput();
    if(syncTrack == 0 || !disableListWhenSyncTrack)
    {
        this.trackList.handleMouseInput(mouseX, mouseY);
    }
    bandNameString = bandName.getText();
}
 
Example 11
Project: Backmemed   File: GuiScreen.java   Source Code and License Vote up 5 votes
/**
 * Handles mouse input.
 */
public void handleMouseInput() throws IOException
{
    int i = Mouse.getEventX() * this.width / this.mc.displayWidth;
    int j = this.height - Mouse.getEventY() * this.height / this.mc.displayHeight - 1;
    int k = Mouse.getEventButton();

    if (Mouse.getEventButtonState())
    {
        if (this.mc.gameSettings.touchscreen && this.touchValue++ > 0)
        {
            return;
        }

        this.eventButton = k;
        this.lastMouseEvent = Minecraft.getSystemTime();
        this.mouseClicked(i, j, this.eventButton);
    }
    else if (k != -1)
    {
        if (this.mc.gameSettings.touchscreen && --this.touchValue > 0)
        {
            return;
        }

        this.eventButton = -1;
        this.mouseReleased(i, j, k);
    }
    else if (this.eventButton != -1 && this.lastMouseEvent > 0L)
    {
        long l = Minecraft.getSystemTime() - this.lastMouseEvent;
        this.mouseClickMove(i, j, this.eventButton, l);
    }
}
 
Example 12
Project: CustomWorldGen   File: GuiModList.java   Source Code and License Vote up 5 votes
/**
 * Handles mouse input.
 */
@Override
public void handleMouseInput() throws IOException
{
    int mouseX = Mouse.getEventX() * this.width / this.mc.displayWidth;
    int mouseY = this.height - Mouse.getEventY() * this.height / this.mc.displayHeight - 1;

    super.handleMouseInput();
    if (this.modInfo != null)
        this.modInfo.handleMouseInput(mouseX, mouseY);
    this.modList.handleMouseInput(mouseX, mouseY);
}
 
Example 13
Project: CustomWorldGen   File: MouseEvent.java   Source Code and License Vote up 5 votes
public MouseEvent()
{
    this.x = Mouse.getEventX();
    this.y = Mouse.getEventY();
    this.dx = Mouse.getEventDX();
    this.dy = Mouse.getEventDY();
    this.dwheel = Mouse.getEventDWheel();
    this.button = Mouse.getEventButton();
    this.buttonstate = Mouse.getEventButtonState();
    this.nanoseconds = Mouse.getEventNanoseconds();
}
 
Example 14
Project: CustomWorldGen   File: GuiScreen.java   Source Code and License Vote up 5 votes
/**
 * Handles mouse input.
 */
public void handleMouseInput() throws IOException
{
    int i = Mouse.getEventX() * this.width / this.mc.displayWidth;
    int j = this.height - Mouse.getEventY() * this.height / this.mc.displayHeight - 1;
    int k = Mouse.getEventButton();

    if (Mouse.getEventButtonState())
    {
        if (this.mc.gameSettings.touchscreen && this.touchValue++ > 0)
        {
            return;
        }

        this.eventButton = k;
        this.lastMouseEvent = Minecraft.getSystemTime();
        this.mouseClicked(i, j, this.eventButton);
    }
    else if (k != -1)
    {
        if (this.mc.gameSettings.touchscreen && --this.touchValue > 0)
        {
            return;
        }

        this.eventButton = -1;
        this.mouseReleased(i, j, k);
    }
    else if (this.eventButton != -1 && this.lastMouseEvent > 0L)
    {
        long l = Minecraft.getSystemTime() - this.lastMouseEvent;
        this.mouseClickMove(i, j, this.eventButton, l);
    }
}
 
Example 15
Project: ToolBelt   File: GuiRadialMenu.java   Source Code and License Vote up 4 votes
@Override
public void updateScreen()
{
    super.updateScreen();

    if (closing)
    {
        if (doneClosing || inventory == null)
        {
            Minecraft.getMinecraft().displayGuiScreen(null);

            ClientProxy.wipeOpen();
        }

        return;
    }

    ItemStack inHand = mc.player.getHeldItemMainhand();
    if (!Config.isItemStackAllowed(inHand))
    {
        inventory = null;
    }
    else
    {
        ItemStack stack = getter.getBelt();
        if (stack.getCount() <= 0)
        {
            inventory = null;
            stackEquipped = null;
        }
        // Reference comparison intended
        else if (stackEquipped != stack)
        {
            stackEquipped = stack;
            inventory = ItemToolBelt.getItems(stack);
            cachedStacks = null;
        }
    }

    if (inventory == null)
    {
        Minecraft.getMinecraft().displayGuiScreen(null);
    }
    else if (!GameSettings.isKeyDown(ClientProxy.keyOpenToolMenu))
    {
        if (Config.releaseToSwap)
        {
            int x = Mouse.getEventX() * this.width / this.mc.displayWidth;
            int y = this.height - Mouse.getEventY() * this.height / this.mc.displayHeight - 1;
            mouseReleased(x, y, -1);
        }
        else
        {
            animateClose();
        }
    }
}
 
Example 16
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);
    }
}