Java 类org.lwjgl.input.Mouse 实例源码

项目:CustomWorldGen    文件:GuiContainerCreative.java   
/**
 * Handles mouse input.
 */
public void handleMouseInput() throws IOException
{
    super.handleMouseInput();
    int i = Mouse.getEventDWheel();

    if (i != 0 && this.needsScrollBars())
    {
        int j = (((GuiContainerCreative.ContainerCreative)this.inventorySlots).itemList.size() + 9 - 1) / 9 - 5;

        if (i > 0)
        {
            i = 1;
        }

        if (i < 0)
        {
            i = -1;
        }

        this.currentScroll = (float)((double)this.currentScroll - (double)i / (double)j);
        this.currentScroll = MathHelper.clamp_float(this.currentScroll, 0.0F, 1.0F);
        ((GuiContainerCreative.ContainerCreative)this.inventorySlots).scrollTo(this.currentScroll);
    }
}
项目:BaseClient    文件:ClickGui.java   
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);
    }
}
项目:pnc-repressurized    文件:GuiSecurityStationHacking.java   
public void addExtraHackInfo(List<String> currenttip) {
    int mouseX = Mouse.getX() * this.width / this.mc.displayWidth;
    int mouseY = this.height - Mouse.getY() * this.height / this.mc.displayHeight - 1;
    Slot slot = getSlotAtPosition(mouseX, mouseY);
    if (slot != null) {
        if (hackerBridges.slotHacked[slot.slotNumber]) {
            if (!hackerBridges.slotFortified[slot.slotNumber]) {
                currenttip.add(TextFormatting.RED + "DETECTION: " + te.getDetectionChance() + "%");
                currenttip.add(TextFormatting.YELLOW + "Right-click to fortify");
            }
        } else if (hackerBridges.canHackSlot(slot.slotNumber)) {
            currenttip.add(TextFormatting.RED + "DETECTION: " + te.getDetectionChance() + "%");
            currenttip.add(TextFormatting.GREEN + "Left-click to hack");

        }
    }
}
项目:Firma    文件:ClayItem.java   
@Override
public ActionResult<ItemStack> onItemRightClick(World worldIn, EntityPlayer player, EnumHand handIn) {
    Mouse.setGrabbed(false); // TODO Remove debug
    ItemStack is = player.getHeldItem(handIn);
    if (player.getHeldItemMainhand().getCount() > 4) {
        if (worldIn.isRemote) {
            GuiKnapping.staticMaterial = CraftMat.CLAY;
            GuiKnapping.staticMaterialSub = this.getSubName(is.getItemDamage());

            player.openGui(FirmaMod.instance, GuiHandler.GUI_KNAPPING, player.world, (int) player.posX, (int) player.posY, (int) player.posZ);
        } else {
            PlayerData pd = PlayerData.getPlayerData(player.getUniqueID());
            pd.resetKnapCraft();
            pd.setItemStack(player.getHeldItemMainhand());
            pd.setCraftingMaterial(CraftMat.CLAY);
        }
    }
    return new ActionResult<ItemStack>(EnumActionResult.PASS, is);
}
项目:OpenGL-Bullet-engine    文件:Renderer.java   
@Override
    public void onMouseButton(MouseButtonEvent e){
        Gui openGui=guiHandler.getOpenGui();
        if(openGui!=null) openGui.onMouseButton(e);
        else e.source.centerMouse();

        if(e.action==Action.DOWN){
            if(Shaders.ENTITY!=null){
                Shaders.ENTITY.load();
                Shaders.TERRAIN.load();
//              Shaders.SKYBOX.load();
//              Shaders.GUI_RECT.load();
//              Shaders.POST_COPY.load();
            }
        }

        Mouse.setGrabbed(!Game.isPaused());
    }
项目:OpenGL-Bullet-engine    文件:Camera.java   
@Override
public void onMouseMove(MouseMoveEvent e){
    if(!Game.win().isFocused()||!Mouse.isGrabbed()) return;
    if(noMouseMode){
        if(Keyboard.isKeyDown(Keyboard.KEY_Q)) rot.y-=0.1;
        if(Keyboard.isKeyDown(Keyboard.KEY_E)) rot.y+=0.1;
        if(Keyboard.isKeyDown(Keyboard.KEY_R)) rot.x-=0.1;
        if(Keyboard.isKeyDown(Keyboard.KEY_F)) rot.x+=0.1;
    }else{
        rot.x-=e.yDelta/200F;
        rot.y+=e.xDelta/200F;
        Game.win().centerMouse();
    }

    if(rot.x>Math.PI/2) rot.x=(float)(Math.PI/2);
    else if(rot.x<-Math.PI/2) rot.x=(float)(-Math.PI/2);
}
项目:DecompiledMinecraft    文件:GuiScreen.java   
/**
 * Delegates mouse and keyboard input.
 */
public void handleInput() throws IOException
{
    if (Mouse.isCreated())
    {
        while (Mouse.next())
        {
            this.handleMouseInput();
        }
    }

    if (Keyboard.isCreated())
    {
        while (Keyboard.next())
        {
            this.handleKeyboardInput();
        }
    }
}
项目:BaseClient    文件:GuiContainerCreative.java   
/**
 * Handles mouse input.
 */
public void handleMouseInput() throws IOException
{
    super.handleMouseInput();
    int i = Mouse.getEventDWheel();

    if (i != 0 && this.needsScrollBars())
    {
        int j = ((GuiContainerCreative.ContainerCreative)this.inventorySlots).itemList.size() / 9 - 5;

        if (i > 0)
        {
            i = 1;
        }

        if (i < 0)
        {
            i = -1;
        }

        this.currentScroll = (float)((double)this.currentScroll - (double)i / (double)j);
        this.currentScroll = MathHelper.clamp_float(this.currentScroll, 0.0F, 1.0F);
        ((GuiContainerCreative.ContainerCreative)this.inventorySlots).scrollTo(this.currentScroll);
    }
}
项目:BaseClient    文件:AppGameContainer.java   
/**
 * @see org.newdawn.slick.GameContainer#setMouseCursor(org.newdawn.slick.Image, int, int)
 */
public void setMouseCursor(Image image, int hotSpotX, int hotSpotY) throws SlickException {
    try {
        Image temp = new Image(get2Fold(image.getWidth()), get2Fold(image.getHeight()));
        Graphics g = temp.getGraphics();

        ByteBuffer buffer = BufferUtils.createByteBuffer(temp.getWidth() * temp.getHeight() * 4);
        g.drawImage(image.getFlippedCopy(false, true), 0, 0);
        g.flush();
        g.getArea(0,0,temp.getWidth(),temp.getHeight(),buffer);

        Cursor cursor = CursorLoader.get().getCursor(buffer, hotSpotX, hotSpotY,temp.getWidth(),image.getHeight());
        Mouse.setNativeCursor(cursor);
    } catch (Throwable e) {
        Log.error("Failed to load and apply cursor.", e);
        throw new SlickException("Failed to set mouse cursor", e);
    }
}
项目:BaseClient    文件:GuiChat.java   
/**
 * Handles mouse input.
 */
public void handleMouseInput() throws IOException
{
    super.handleMouseInput();
    int i = Mouse.getEventDWheel();

    if (i != 0)
    {
        if (i > 1)
        {
            i = 1;
        }

        if (i < -1)
        {
            i = -1;
        }

        if (!isShiftKeyDown())
        {
            i *= 7;
        }

        this.mc.ingameGUI.getChatGUI().scroll(i);
    }
}
项目:BaseClient    文件:GuiChat.java   
/**
 * Handles mouse input.
 */
public void handleMouseInput() throws IOException
{
    super.handleMouseInput();
    int i = Mouse.getEventDWheel();

    if (i != 0)
    {
        if (i > 1)
        {
            i = 1;
        }

        if (i < -1)
        {
            i = -1;
        }

        if (!isShiftKeyDown())
        {
            i *= 7;
        }

        this.mc.ingameGUI.getChatGUI().scroll(i);
    }
}
项目:Mods    文件:TF2EventsClient.java   
@SubscribeEvent
public void renderTick(TickEvent.RenderTickEvent event) {

    tickTime = event.renderTickTime;
    Minecraft minecraft = Minecraft.getMinecraft();
    if (event.phase == Phase.END)
        if (minecraft.player != null && minecraft.player.getHeldItemMainhand() != null)
            if (minecraft.player.getHeldItemMainhand().getItem() instanceof ItemUsable) {
                Mouse.poll();
                minecraft.player.rotationYawHead = minecraft.player.rotationYaw;
                moveEntities = true;
                keyPressUpdate(Mouse.isButtonDown(minecraft.gameSettings.keyBindAttack.getKeyCode() + 100),
                        Mouse.isButtonDown(minecraft.gameSettings.keyBindUseItem.getKeyCode() + 100));
                moveEntities = false;
            }
}
项目:Wurst-MC-1.12    文件:NavigatorScreen.java   
@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;
    }
}
项目:Progetto-C    文件:AppGameContainer.java   
/**
 * @see org.newdawn.slick.GameContainer#setMouseCursor(org.newdawn.slick.Image, int, int)
 */
public void setMouseCursor(Image image, int hotSpotX, int hotSpotY) throws SlickException {
    try {
        Image temp = new Image(get2Fold(image.getWidth()), get2Fold(image.getHeight()));
        Graphics g = temp.getGraphics();

        ByteBuffer buffer = BufferUtils.createByteBuffer(temp.getWidth() * temp.getHeight() * 4);
        g.drawImage(image.getFlippedCopy(false, true), 0, 0);
        g.flush();
        g.getArea(0,0,temp.getWidth(),temp.getHeight(),buffer);

        Cursor cursor = CursorLoader.get().getCursor(buffer, hotSpotX, hotSpotY,temp.getWidth(),image.getHeight());
        Mouse.setNativeCursor(cursor);
    } catch (Throwable e) {
        Log.error("Failed to load and apply cursor.", e);
        throw new SlickException("Failed to set mouse cursor", e);
    }
}
项目:Whoosh    文件:GuiTransporter.java   
@Override
public void handleMouseInput() throws IOException {

    super.handleMouseInput();

    int textAreaX = taPoints.xPos - guiLeft;
    int textAreaY = taPoints.yPos - guiTop;

    if (textAreaX <= mouseX && mouseX < textAreaX + taPoints.width && mouseY >= textAreaY && mouseY < textAreaY + taPoints.height) {
        int wheelDir = Mouse.getEventDWheel();

        if (wheelDir < 0) {
            taPoints.scrollUp();
        }

        if (wheelDir > 0) {
            taPoints.scrollDown();
        }
    }
}
项目:BaseClient    文件:AppletGameContainer.java   
/**
  * {@inheritDoc}
  */
 public void setMouseCursor(Image image, int hotSpotX, int hotSpotY) throws SlickException {
     try {
        Image temp = new Image(get2Fold(image.getWidth()), get2Fold(image.getHeight()));
        Graphics g = temp.getGraphics();

        ByteBuffer buffer = BufferUtils.createByteBuffer(temp.getWidth() * temp.getHeight() * 4);
        g.drawImage(image.getFlippedCopy(false, true), 0, 0);
        g.flush();
        g.getArea(0,0,temp.getWidth(),temp.getHeight(),buffer);

        Cursor cursor = CursorLoader.get().getCursor(buffer, hotSpotX, hotSpotY,temp.getWidth(),temp.getHeight());
        Mouse.setNativeCursor(cursor);
     } catch (Throwable e) {
        Log.error("Failed to load and apply cursor.", e);
throw new SlickException("Failed to set mouse cursor", e);
     }
  }
项目:bit-client    文件:NoThemeButtonComponent.java   
@Override
public void render(float mouseX, float mouseY, boolean mouseOver, VectorUtil position, VectorUtil size, Object... payload) {
    String title = (String) payload[0];
    int alpha = (int) payload[1];
    boolean color = (boolean) payload[2];
    boolean centered = (boolean) payload[3];

    if (mouseOver)
        TessRenderUtil.drawRect(position.getX() + (centered ? 15 + 18 - 1 : 6), position.getY() + 3.5f,
                (float) (position.getX() + (centered ? 15 + 18 : 6) + Wrapper.getStringWidth(title) / 2
                        + 3),
                position.getY() + size.getY() + 1,
                new ColorBuilder(20, 20, 20, 145).build_hex());

    TessRenderUtil.drawBorderedRect(position.getX() + (centered ? 15 + 18 : 6) - 1, position.getY() + 3.5f,
            (float) (position.getX() + (centered ? 15 + 18 : 6) + Wrapper.getStringWidth(title) / 2
                    + 3),
            position.getY() + size.getY() + 1, Mouse.isButtonDown(0) && mouseOver ? 0.8f : 0.6f,
            new ColorBuilder(20, 20, 20, 145).build_hex(), new ColorBuilder(255, 255, 255, alpha).build_hex());


    Wrapper.drawStringWithShadow_scaled(title, (int) (position.getX() + (centered ? 15 + 18 : 6) + 1),
            (int) (position.getY() + 6), color ? ColorUtil.getClientColor() : -1, 0.5);
}
项目:Backmemed    文件:GuiScreen.java   
/**
 * Delegates mouse and keyboard input.
 */
public void handleInput() throws IOException
{
    if (Mouse.isCreated())
    {
        while (Mouse.next())
        {
            this.handleMouseInput();
        }
    }

    if (Keyboard.isCreated())
    {
        while (Keyboard.next())
        {
            this.handleKeyboardInput();
        }
    }
}
项目:HCMIU_PlantsAndZombies    文件:GameOver.java   
private void showExitGameButton(GameContainer gc, Graphics g) throws SlickException {
    float rate = 1.14f;
    float posX = 885 * PZGUI.getResolutionRateWidth();
    float posY = 430 * PZGUI.getResolutionRateHeight();
    float width = newGameButton.getWidth() * PZGUI.getResolutionRateWidth() * rate;
    float height = newGameButton.getHeight() * PZGUI.getResolutionRateHeight() * rate;

    exitGameButton.draw(posX, posY, width, height);

    if (Controller.mouseInArea(posX, posY, posX + width, posY + height)) {
        exitGameButton.draw(posX, posY, width, height, new Color(0, 0, 0, 100));
        if (Mouse.getEventButtonState() && Mouse.getEventButton() == 0) {
            gc.exit();
            try {
                TimeUnit.MILLISECONDS.sleep(100);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        }
    }
}
项目:HCMIU_PlantsAndZombies    文件:PlayUI.java   
/**
 * Draw Pause button
 * @param gc    GameContainer
 * @param g Graphics
 * @throws SlickException
 */
public static void showPauseButton(GameContainer gc, Graphics g) throws SlickException {
    pauseButton.draw(pauseButtonPosX, pauseButtonPosY, pauseButtonWidth, pauseButtonHeight);

    if (Controller.mouseInArea(pauseButtonPosX, pauseButtonPosY, pauseButtonPosX + pauseButtonHeight,
                                pauseButtonPosY + pauseButtonHeight)) {
        pauseButton.draw(pauseButtonPosX, pauseButtonPosY, pauseButtonWidth, pauseButtonHeight, new Color(0, 0, 0, 50));

        if (Mouse.getEventButtonState() && Mouse.getEventButton() == 0) {
            gc.setPaused(!gc.isPaused());
            try {
                TimeUnit.MILLISECONDS.sleep(100);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        }
    }
}
项目:HCMIU_PlantsAndZombies    文件:PlayUI.java   
/**
 * Show Shovel button
 * @param gc    GameContainer
 * @param g Graphics
 */
public static void showShovel(GameContainer gc, Graphics g) {
    shovel.draw(shovelButtonPosX, shovelButtonPosY, shovelButtonWidth, shovelButtonHeight);
    if (Controller.mouseInArea(shovelButtonPosX, shovelButtonPosY, shovelButtonPosX + shovelButtonWidth, shovelButtonPosY + shovelButtonHeight)) {
        shovel.draw(shovelButtonPosX, shovelButtonPosY, shovelButtonWidth, shovelButtonHeight, new Color(0, 0, 0, 100));
        if (Mouse.getEventButtonState() && Mouse.getEventButton() == 0) {
            isShovelClicked = !isShovelClicked;
            try {
                TimeUnit.MILLISECONDS.sleep(100);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        }
    }
    if (isShovelClicked) {
        shovel.draw(Controller.getMouseX() - (20 * PZGUI.getResolutionRateWidth()), 
                    Controller.getMouseY() - (30 * PZGUI.getResolutionRateHeight()), 
                    shovelButtonWidth, 
                    shovelButtonHeight);
    }       
}
项目:HCMIU_PlantsAndZombies    文件:SplashScreen.java   
public void startButton(GameContainer gc, StateBasedGame sbg, Graphics g) throws SlickException {
    float rate = 0.9f;
    float width = playButton.getWidth() * PZGUI.getResolutionRateWidth() * rate;
    float height = playButton.getHeight() * PZGUI.getResolutionRateHeight() * rate;

    float posX = PZGUI.getWidth()  /2 - width/2;
    float posY = PZGUI.getHeight() * (float)(0.7) - height/2;

    float edgeX = posX + width;
    float edgeY = posY + height;

    playButton.draw(posX, posY, width, height);
    if (    Mouse.getX() >= posX && 
            Mouse.getX() <= edgeX && 
            PZGUI.getHeight() - Mouse.getY() >= posY    && 
            PZGUI.getHeight() - Mouse.getY() <= edgeY) {
        playButton.draw(posX, posY, width, height, new Color(100, 100, 100, 60));

        if (Mouse.isButtonDown(0))
            sbg.enterState(1);
    }
}
项目:BaseClient    文件:GuiChat.java   
/**
 * Called when the mouse is clicked. Args : mouseX, mouseY, clickedButton
 */
protected void mouseClicked(int mouseX, int mouseY, int mouseButton) throws IOException
{
    if (mouseButton == 0)
    {
        IChatComponent ichatcomponent = this.mc.ingameGUI.getChatGUI().getChatComponent(Mouse.getX(), Mouse.getY());

        if (this.handleComponentClick(ichatcomponent))
        {
            return;
        }
    }

    this.inputField.mouseClicked(mouseX, mouseY, mouseButton);
    super.mouseClicked(mouseX, mouseY, mouseButton);
}
项目:Backmemed    文件:GuiContainerCreative.java   
/**
 * Handles mouse input.
 */
public void handleMouseInput() throws IOException
{
    super.handleMouseInput();
    int i = Mouse.getEventDWheel();

    if (i != 0 && this.needsScrollBars())
    {
        int j = (((GuiContainerCreative.ContainerCreative)this.inventorySlots).itemList.size() + 9 - 1) / 9 - 5;

        if (i > 0)
        {
            i = 1;
        }

        if (i < 0)
        {
            i = -1;
        }

        this.currentScroll = (float)((double)this.currentScroll - (double)i / (double)j);
        this.currentScroll = MathHelper.clamp(this.currentScroll, 0.0F, 1.0F);
        ((GuiContainerCreative.ContainerCreative)this.inventorySlots).scrollTo(this.currentScroll);
    }
}
项目:PurificatiMagicae    文件:GuiMicroscopeResearch.java   
private void performAction(int x, int y, boolean checkPos)
{
    x = x - maxLeft;
    y = y - maxUp;
    if(x > 0 && y > 0)
    {
        int col = x / buttSize;
        int row = y / buttSize;
        if(!checkPos || (prevC != col || prevR != row))
        {
            prevC = col;
            prevR = row;
            if (Mouse.isButtonDown(0))
            {
                current[row][col] = !current[row][col];
                Minecraft.getMinecraft().player.playSound(SoundRegistry.MAGICAL_CLICK, 1, 1);
            } else if (Mouse.isButtonDown(1))
            {
                crosses[row][col] = !crosses[row][col];
                Minecraft.getMinecraft().player.playSound(SoundRegistry.MAGICAL_CLICK, 1, 1);
            }
        }
    }
}
项目:trashjam2017    文件:AppletGameContainer.java   
/**
* @see org.newdawn.slick.GameContainer#setMouseCursor(java.lang.String,
*      int, int)
*/
   public void setMouseCursor(String ref, int hotSpotX, int hotSpotY) throws SlickException {
      try {
         Cursor cursor = CursorLoader.get().getCursor(ref, hotSpotX, hotSpotY);
         Mouse.setNativeCursor(cursor);
      } catch (Throwable e) {
         Log.error("Failed to load and apply cursor.", e);
throw new SlickException("Failed to set mouse cursor", e);
      }
   }
项目:trashjam2017    文件:AppletGameContainer.java   
/**
    * @see org.newdawn.slick.GameContainer#setMouseCursor(org.lwjgl.input.Cursor, int, int)
    */
   public void setMouseCursor(Cursor cursor, int hotSpotX, int hotSpotY) throws SlickException {
      try {
         Mouse.setNativeCursor(cursor);
      } catch (Throwable e) {
         Log.error("Failed to load and apply cursor.", e);
throw new SlickException("Failed to set mouse cursor", e);
      }
   }
项目:Backmemed    文件:GuiChat.java   
/**
 * Draws the screen and all the components in it.
 */
public void drawScreen(int mouseX, int mouseY, float partialTicks)
{
    drawRect(2, this.height - 14, this.width - 2, this.height - 2, Integer.MIN_VALUE);
    this.inputField.drawTextBox();
    ITextComponent itextcomponent = this.mc.ingameGUI.getChatGUI().getChatComponent(Mouse.getX(), Mouse.getY());

    if (itextcomponent != null && itextcomponent.getStyle().getHoverEvent() != null)
    {
        this.handleComponentHover(itextcomponent, mouseX, mouseY);
    }

    super.drawScreen(mouseX, mouseY, partialTicks);
}
项目:OcclusionQueries    文件:Camera.java   
private void calculateAngleAroundPlayer(){
    if(Mouse.isButtonDown(0)){
        float angleChange = Mouse.getDX() * 0.3f;
        angleAroundPlayer.increaseTarget(-angleChange);;
    }else if(Keyboard.isKeyDown(Keyboard.KEY_R)){
        angleAroundPlayer.increaseTarget(0.05f);
    }
    angleAroundPlayer.update(0.01f);
}
项目:trashjam2017    文件:Input.java   
/**
 * Check if any mouse button is down
 * 
 * @return True if any mouse button is down
 */
private boolean anyMouseDown() {
    for (int i=0;i<3;i++) {
        if (Mouse.isButtonDown(i)) {
            return true;
        }
    }

    return false;
}
项目:BaseClient    文件:AppGameContainer.java   
/**
 * @see org.newdawn.slick.GameContainer#setDefaultMouseCursor()
 */
public void setDefaultMouseCursor() {
    try {
        Mouse.setNativeCursor(null);
    } catch (LWJGLException e) {
        Log.error("Failed to reset mouse cursor", e);
    }
}
项目:CustomWorldGen    文件:MouseEvent.java   
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();
}
项目:Proyecto-DASI    文件:MalmoModClient.java   
@Override
/**
 * Ungrabs the mouse cursor so it can be moved and set it to the center of the screen
 */
public void ungrabMouseCursor()
{
    // Vanilla Minecraft calls Mouse.setCursorPosition(Display.getWidth() / 2, Display.getHeight() / 2) at this point...
    // but it's seriously annoying, so we don't.
    Mouse.setGrabbed(false);
}
项目:BaseClient    文件:MouseHelper.java   
/**
 * Grabs the mouse cursor it doesn't move and isn't seen.
 */
public void grabMouseCursor()
{
    Mouse.setGrabbed(true);
    this.deltaX = 0;
    this.deltaY = 0;
}
项目:bit-client    文件:ComponentList.java   
@Override
public void render(float mouseX, float mouseY) {
    Bit.getInstance().getThemeManager().getRenderComponent(ComponentList.class).render(mouseX, mouseY, mouseOver(mouseX, mouseY), getPosition(), getSize(), drawBackground, totalPosY, (parent instanceof Window ? ((Window) parent).isDragging() && Mouse.isButtonDown(0) : (parent instanceof ModComponent && ((ModComponent) parent).getParent().isDragging()) && Mouse.isButtonDown(0)));
    try {
        this.components.forEach(comp -> {
            comp.render(mouseX, mouseY);
        });
    } catch (Exception e) {
    }
}
项目:BaseClient    文件:AppletGameContainer.java   
/**
    * @see org.newdawn.slick.GameContainer#setMouseCursor(org.newdawn.slick.opengl.ImageData, int, int)
    */
   public void setMouseCursor(ImageData data, int hotSpotX, int hotSpotY) throws SlickException {
      try {
         Cursor cursor = CursorLoader.get().getCursor(data, hotSpotX, hotSpotY);
         Mouse.setNativeCursor(cursor);
      } catch (Throwable e) {
         Log.error("Failed to load and apply cursor.", e);
throw new SlickException("Failed to set mouse cursor", e);
      }
   }
项目:rezolve    文件:RemoteShellGuiContainer.java   
@Override
public void handleMouseInput() throws IOException {
    super.handleMouseInput();

    BlockPos[] machines = this.entity.getConnectedMachines();

    this.listScrollPosition += Mouse.getEventDWheel() / 10;
    this.listScrollPosition = Math.min(0, this.listScrollPosition);
    this.listScrollPosition = Math.max(Math.min(0, machines.length * this.slotHeight * -1 + this.listHeight), this.listScrollPosition);
}
项目:Clef    文件:GuiPlayTrack.java   
@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();
}
项目:CustomWorldGen    文件:GuiChat.java   
/**
 * Draws the screen and all the components in it.
 */
public void drawScreen(int mouseX, int mouseY, float partialTicks)
{
    drawRect(2, this.height - 14, this.width - 2, this.height - 2, Integer.MIN_VALUE);
    this.inputField.drawTextBox();
    ITextComponent itextcomponent = this.mc.ingameGUI.getChatGUI().getChatComponent(Mouse.getX(), Mouse.getY());

    if (itextcomponent != null && itextcomponent.getStyle().getHoverEvent() != null)
    {
        this.handleComponentHover(itextcomponent, mouseX, mouseY);
    }

    super.drawScreen(mouseX, mouseY, partialTicks);
}
项目:Elgin-Plant-Game    文件:Camera.java   
private void calculateZoom() {
    float zoomLevel = Mouse.getDWheel() * 0.1f;
    distanceFromPlayer -= zoomLevel;
    if (distanceFromPlayer < 12f)
        distanceFromPlayer = 12f;
    if (distanceFromPlayer > 100f)
        distanceFromPlayer = 100f;
}