• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java Point类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.lwjgl.util.Point的典型用法代码示例。如果您正苦于以下问题:Java Point类的具体用法?Java Point怎么用?Java Point使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



Point类属于org.lwjgl.util包,在下文中一共展示了Point类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: render

import org.lwjgl.util.Point; //导入依赖的package包/类
@Override
public void render()
{
    super.render();
    if (step.shouldShowStack())
    {
        Point pos = getPosOnScreen();
        DrawingTools.drawString(step.getDescription(), 5, display.getWidth(), Colors.WHITE, getWidth() - 5);
        int x = (getWidth() - display.getWidth()) / 2;
        display.draw(getGuiScreen(), x, 0);
        if(isFocused())
            display.drawTooltip(getGuiScreen(), x, 0, getLastMouseX(), getLastMouseY(), pos.getX(), pos.getY());
    }
    else
        DrawingTools.drawString(step.getDescription(), 5, 0, Colors.WHITE, getWidth() - 5);
}
 
开发者ID:PearXTeam,项目名称:PurificatiMagicae,代码行数:17,代码来源:IRSIngredientRenderer.java


示例2: getTooltip

import org.lwjgl.util.Point; //导入依赖的package包/类
@Override
public GuiElement getTooltip(RenderInfo renderInfo) {
    if (tooltip != null && lastSize != null) {
        Point mouse = new Point(renderInfo.mouseX, renderInfo.mouseY);
        if (container != null) {
            container.convertFor(this, mouse);
        }
        if (mouse.getX() > 0
                && mouse.getY() > 0
                && mouse.getX() < lastSize.getWidth()
                && mouse.getY() < lastSize.getHeight()) {
            return tooltip;
        }
    }
    return null;
}
 
开发者ID:ReplayMod,项目名称:jGui,代码行数:17,代码来源:AbstractGuiElement.java


示例3: mouseClick

import org.lwjgl.util.Point; //导入依赖的package包/类
@Override
public boolean mouseClick(ReadablePoint position, int button) {
    if (getContainer() != null) {
        getContainer().convertFor(this, (Point) (position = new Point(position)));
    }
    boolean hovering = isMouseHovering(position);

    if (hovering && isFocused() && button == 0) {
        updateCurrentOffset();
        int mouseX = position.getX() - BORDER;
        FontRenderer fontRenderer = getMinecraft().fontRendererObj;
        String text = this.text.substring(currentOffset);
        int textX = fontRenderer.trimStringToWidth(text, mouseX).length() + currentOffset;
        setCursorPosition(textX);
        return true;
    }

    setFocused(hovering);
    // Do not yet return true to allow focusables later in the event chain to be notified of the focus change
    return false;
}
 
开发者ID:ReplayMod,项目名称:jGui,代码行数:22,代码来源:AbstractGuiTextField.java


示例4: draw

import org.lwjgl.util.Point; //导入依赖的package包/类
@Override
public void draw(GuiRenderer renderer, ReadableDimension size, RenderInfo renderInfo) {
    super.draw(renderer, size, renderInfo);
    int width = size.getWidth();
    int height = size.getHeight();

    renderer.bindTexture(TEXTURE);

    // Draw background
    // We have to increase the border size as there is one pixel row which is part of the border while drawing
    // but isn't during position calculations due to shadows
    Utils.drawDynamicRect(renderer, width, height, TEXTURE_BG_X, TEXTURE_BG_Y, TEXTURE_BG_WIDTH, TEXTURE_BG_HEIGHT,
            BORDER_TOP + 1, BORDER_BOTTOM, BORDER_LEFT + 1, BORDER_RIGHT);

    // Draw slider
    int bodyWidth = size.getWidth() - BORDER_LEFT - BORDER_RIGHT;
    int barOffset = (int) (bodyWidth * offset) + BORDER_LEFT;
    int barWidth = (int) (bodyWidth * zoom);
    Utils.drawDynamicRect(new OffsetGuiRenderer(renderer, new Point(barOffset, BORDER_TOP), size),
            barWidth, height - (BORDER_TOP + 1) - BORDER_BOTTOM,
            TEXTURE_FG_X, TEXTURE_FG_Y, TEXTURE_FG_WIDTH, TEXTURE_FG_HEIGHT, 2, 1, 1, 1);
}
 
开发者ID:ReplayMod,项目名称:jGui,代码行数:23,代码来源:AbstractGuiHorizontalScrollbar.java


示例5: mouseClick

import org.lwjgl.util.Point; //导入依赖的package包/类
@Override
public boolean mouseClick(ReadablePoint position, int button) {
    Point point = new Point(position);
    getContainer().convertFor(this, point);
    if (point.getX() > 0 && point.getX() < getLastSize().getWidth()
            && point.getY() > 0 && point.getY() < getLastSize().getHeight()) {
        if (selected != this) {
            selected = this;
            onSelectionChanged();
        } else if (System.currentTimeMillis() - selectedLastClickTime < DOUBLE_CLICK_INTERVAL) {
            onSelectionDoubleClicked();
        }
        selectedLastClickTime = System.currentTimeMillis();
        return true;
    }
    return false;
}
 
开发者ID:ReplayMod,项目名称:jGui,代码行数:18,代码来源:AbstractGuiResourceLoadingList.java


示例6: mouseClick

import org.lwjgl.util.Point; //导入依赖的package包/类
@Override
public boolean mouseClick(ReadablePoint position, int button) {
    if (getContainer() != null) {
        getContainer().convertFor(this, (Point) (position = new Point(position)));
    }
    boolean hovering = isMouseHovering(position);

    if (hovering && isFocused() && button == 0) {
        updateCurrentOffset();
        int mouseX = position.getX() - BORDER;
        int mouseY = position.getY() - BORDER;
        FontRenderer fontRenderer = getMinecraft().fontRendererObj;
        int textY = clamp_int(mouseY / (fontRenderer.FONT_HEIGHT + LINE_SPACING) + currentYOffset, 0, text.length - 1);
        if (cursorY != textY) {
            currentXOffset = 0;
        }
        String line = text[textY].substring(currentXOffset);
        int textX = fontRenderer.trimStringToWidth(line, mouseX).length() + currentXOffset;
        setCursorPosition(textX, textY);
    }

    setFocused(hovering);
    return hovering;
}
 
开发者ID:ReplayMod,项目名称:jGui,代码行数:25,代码来源:AbstractGuiTextArea.java


示例7: renderOverlay

import org.lwjgl.util.Point; //导入依赖的package包/类
@SubscribeEvent
public void renderOverlay(RenderGameOverlayEvent.Post event) {
    if (event.type == RenderGameOverlayEvent.ElementType.ALL) {
        updateRenderer();
        int layers = getMaxLayer();
        int mouseX = -1, mouseY = -1;
        if (mouseVisible) {
            Point mouse = MouseUtils.getMousePos();
            mouseX = mouse.getX();
            mouseY = mouse.getY();
        }
        for (int layer = 0; layer <= layers; layer++) {
            draw(renderer, screenSize, new RenderInfo(event.partialTicks, mouseX, mouseY, layer));
        }
    }
}
 
开发者ID:ReplayMod,项目名称:jGui,代码行数:17,代码来源:AbstractGuiOverlay.java


示例8: updateDummyDepot

import org.lwjgl.util.Point; //导入依赖的package包/类
private void updateDummyDepot() {
    if(dummyDepot != null) {
        dummyDepot.update();

        Camera cam = Camera.getInstance();
        ReadablePoint p = new Point(Mouse.getX(), -Mouse.getY() + cam.getRectangle().getHeight()); // invertieren weil windows andere koordinaten liefert

        float isoMouseX = Math.round(((p.getX() + cam.getPosition().getX()) / Game.TILEWIDTH) - ((p.getY() + cam.getPosition().getY()) / Game.TILEHEIGHT));
        float isoMouseY = Math.round(((p.getX() + cam.getPosition().getX()) / Game.TILEWIDTH) + ((p.getY() + cam.getPosition().getY()) / Game.TILEHEIGHT)) - 1;

        dummyDepot.setTilePos(new Vector2f(isoMouseX, isoMouseY));

        if (Mouse.isButtonDown(0) && !mouseUp) {
            this.addEntity(new Depot(new Vector2f(isoMouseX, isoMouseY), true, BuildingStatic.depot,
                    this));
            dummyDepot = null;
        }

        // right click - enough build
        if (Mouse.isButtonDown(1)) {
            dummyDepot = null;
        }
    }
}
 
开发者ID:deB4SH,项目名称:OpenTransport,代码行数:25,代码来源:EntityController.java


示例9: updateDummyStreet

import org.lwjgl.util.Point; //导入依赖的package包/类
private void updateDummyStreet() {
    if(dummyStreet == null){
        return;
    }
    Camera cam = Camera.getInstance();
    ReadablePoint p = new Point(Mouse.getX(), -Mouse.getY() + cam.getRectangle().getHeight()); // invertieren weil windows andere koordinaten liefert

    float isoMouseX = Math.round(((p.getX() + cam.getPosition().getX()) / Game.TILEWIDTH) - ((p.getY() + cam.getPosition().getY()) / Game.TILEHEIGHT));
    float isoMouseY = Math.round(((p.getX() + cam.getPosition().getX()) / Game.TILEWIDTH) + ((p.getY() + cam.getPosition().getY()) / Game.TILEHEIGHT)) - 1;

    dummyStreet.setTilePos(new Vector2f(isoMouseX, isoMouseY));

    if (Mouse.isButtonDown(0) && !mouseUp) {
        this.addEntity(new Street(new Vector2f(isoMouseX, isoMouseY), StreetTID.urban_street_ns));
    }
    // right click - enough build
    if (Mouse.isButtonDown(1)) {
        dummyStreet = null;
    }
}
 
开发者ID:deB4SH,项目名称:OpenTransport,代码行数:21,代码来源:EntityController.java


示例10: update

import org.lwjgl.util.Point; //导入依赖的package包/类
@Override
public void update() {

    Point mousePoint =  new Point(Mouse.getX(), -Mouse.getY() + (int)Window.getDisplay().getY());
    if(this.collisionBox.contains(mousePoint) && Mouse.isButtonDown(0) && !mouseUp){

        if(uiButtonAction != null) {
            uiButtonAction.fireAction(entityController);
        }

        if(this.linkedElement != null) {

            if (this.linkedElement.isVisible()) {
                this.linkedElement.setVisible(false);
            } else {
                this.linkedElement.setVisible(true);
            }
        }
    }

    mouseUp = Mouse.isButtonDown(0);
}
 
开发者ID:deB4SH,项目名称:OpenTransport,代码行数:23,代码来源:UIButton.java


示例11: update

import org.lwjgl.util.Point; //导入依赖的package包/类
@Override
public void update() {

    // X Knöp
    ReadablePoint p = new Point(Mouse.getX(), -Mouse.getY() + 800); // invertieren weil windows andere koordinaten liefert
    if(closeRectangle.contains(p) && Mouse.isButtonDown(0)) {
        gui.closeRequest(this.name);
    }

    // Elemente angeklickt
    for(GuiWindowElement guiWindowElement : this.guiWindowElements) {
        if(guiWindowElement.getRectangle().contains(p) && guiWindowElement.clickable && Mouse.isButtonDown(0)){
            if( lastChosenGuiElement != null) {lastChosenGuiElement.chosen =false;}
            guiWindowElement.chosen = true;
            lastChosenGuiElement = guiWindowElement;
        }
    }
}
 
开发者ID:deB4SH,项目名称:OpenTransport,代码行数:19,代码来源:GuiWindow.java


示例12: drawScreen

import org.lwjgl.util.Point; //导入依赖的package包/类
/**
 * Draws the screen and all the components in it.
 */
// creaturelistgui.png
@Override
public void drawScreen(int par1, int par2, float par3) {
    this.drawDefaultBackground();

    if (dataFields.get(currentDataField).isEnabled()) {
        dataFields.get(currentDataField).render(mc, par1, par2, par3, new Point(this.width, this.height),
                backgroundSize);
    }

    String titleString = "Edit Mob Spawner Settings " + Integer.toString(currentDataField) + "/"
            + Integer.toString(dataFields.size() - 1);
    fontRendererObj.drawString(titleString, (width - fontRendererObj.getStringWidth(titleString)) / 2,
            (height - backgroundSize.getY()) / 2 + 8, 4210752); // White: 16777215
    super.drawScreen(par1, par2, par3);

    if (currentListType != ListType.NONE) {
        scrollingList.drawBackground();
        scrollingList.drawScreen(new Point(this.width, this.height), backgroundSize, par1, par2, par3);
    }
}
 
开发者ID:soultek101,项目名称:projectzulu1.7.10-pre-1.3a,代码行数:25,代码来源:GuiLimitedMobSpawner.java


示例13: render

import org.lwjgl.util.Point; //导入依赖的package包/类
@Override
public void render()
{
    super.render();
    if (draw == null || draw.getStack().getItem() != ItemRegistry.papyrus || !ItemRegistry.papyrus.getId(draw.getStack()).equals(step.id))
    {
        draw = new ItemDrawable(ItemRegistry.papyrus.getPapyrusItem(step.id), 5);
    }
    DrawingTools.drawString(step.getDescription(), 5, draw.getHeight() + 5, Colors.WHITE, getWidth() - 5);
    Point pos = getPosOnScreen();
    draw.drawWithTooltip(getGuiScreen(), (getWidth() - draw.getWidth()) / 2, 0, lastX, lastY, pos.getX(), pos.getY());
}
 
开发者ID:PearXTeam,项目名称:PurificatiMagicae,代码行数:13,代码来源:IRSPapyrusRenderer.java


示例14: render

import org.lwjgl.util.Point; //导入依赖的package包/类
@Override
public void render()
{
    for (Point p : childs)
    {
        DrawingTools.drawLine(getWidth() / 2, getHeight() / 2, p.getX(), p.getY(), 3, getEntries().getTabletScreen().getTablet().data.getLineColorStart(), getEntries().getTabletScreen().getTablet().data.getLineColorEnd());
    }
    if ((getX() + getWidth()) <= 0 || (getY() + getHeight()) <= 0 || getX() >= getEntries().getWidth() || getY() >= getEntries().getHeight())
        return;
    int steps = Minecraft.getMinecraft().player.getCapability(CapabilityRegistry.ENTRY_STORE_CAP, null).getSteps(entry.getId());
    float f = 1;
    if (getEntries().getTabletScreen().getTablet().data.isShouldGlow())
    {
        if (entry.getSteps().size() == 0)
            f = 0;
        else
            f = 1 - (steps / (float) entry.getSteps().size());
    }

    GlStateManager.pushMatrix();
    GlStateManager.translate(0, 0, 1);
    GlStateManager.color(f, 1, f);
    GlStateManager.enableBlend();
    getEntries().getTabletScreen().getTablet().data.getEntryBackground(entry, steps).draw(getGuiScreen(), 0, 0);
    GlStateManager.disableBlend();
    GlStateManager.color(1, 1, 1);

    entry.getIcon().draw(getGuiScreen(), (getWidth() - entry.getIcon().getWidth()) / 2, (getHeight() - entry.getIcon().getHeight()) / 2);
    GlStateManager.popMatrix();
}
 
开发者ID:PearXTeam,项目名称:PurificatiMagicae,代码行数:31,代码来源:GuiIfTabletSEEntry.java


示例15: render2

import org.lwjgl.util.Point; //导入依赖的package包/类
@Override
public void render2()
{
    Point pos = getPosOnScreen();
    inDraw.drawTooltip(getGuiScreen(), xIn, yIn, lastX, lastY, pos.getX(), pos.getY());
    outDraw.drawTooltip(getGuiScreen(), xOut, yOut, lastX, lastY, pos.getX(), pos.getY());
}
 
开发者ID:PearXTeam,项目名称:PurificatiMagicae,代码行数:8,代码来源:FurnaceControl.java


示例16: mouseClick

import org.lwjgl.util.Point; //导入依赖的package包/类
@Override
public boolean mouseClick(ReadablePoint position, int button) {
    Point pos = new Point(position);
    if (getContainer() != null) {
        getContainer().convertFor(this, pos);
    }

    if (isMouseHovering(pos) && isEnabled()) {
        updateValue(pos);
        dragging = true;
        return true;
    }
    return false;
}
 
开发者ID:ReplayMod,项目名称:jGui,代码行数:15,代码来源:AbstractGuiSlider.java


示例17: mouseDrag

import org.lwjgl.util.Point; //导入依赖的package包/类
@Override
public boolean mouseDrag(ReadablePoint position, int button, long timeSinceLastCall) {
    if (dragging) {
        Point pos = new Point(position);
        if (getContainer() != null) {
            getContainer().convertFor(this, pos);
        }
        updateValue(pos);
    }
    return dragging;
}
 
开发者ID:ReplayMod,项目名称:jGui,代码行数:12,代码来源:AbstractGuiSlider.java


示例18: mouseRelease

import org.lwjgl.util.Point; //导入依赖的package包/类
@Override
public boolean mouseRelease(ReadablePoint position, int button) {
    if (dragging) {
        dragging = false;
        Point pos = new Point(position);
        if (getContainer() != null) {
            getContainer().convertFor(this, pos);
        }
        updateValue(pos);
        return true;
    } else {
        return false;
    }
}
 
开发者ID:ReplayMod,项目名称:jGui,代码行数:15,代码来源:AbstractGuiSlider.java


示例19: draw

import org.lwjgl.util.Point; //导入依赖的package包/类
@Override
public void draw(GuiRenderer renderer, ReadableDimension size, RenderInfo renderInfo) {
    super.draw(renderer, size, renderInfo);

    int width = size.getWidth();
    int height = size.getHeight();

    renderer.bindTexture(GuiButton.WIDGETS_TEXTURE);

    // Draw background
    renderer.drawTexturedRect(0, 0, 0, 46, width / 2, height);
    renderer.drawTexturedRect(width / 2, 0, 200 - width / 2, 46, width / 2, height);

    // Draw slider
    int sliderX = (width - 8) * value / steps;
    renderer.drawTexturedRect(sliderX, 0, 0, 66, 4, 20);
    renderer.drawTexturedRect(sliderX + 4, 0, 196, 66, 4, 20);

    // Draw text
    int color = 0xe0e0e0;
    if (!isEnabled()) {
        color = 0xa0a0a0;
    } else if (isMouseHovering(new Point(renderInfo.mouseX, renderInfo.mouseY))) {
        color = 0xffffa0;
    }
    renderer.drawCenteredString(width / 2, height / 2 - 4, color, text);
}
 
开发者ID:ReplayMod,项目名称:jGui,代码行数:28,代码来源:AbstractGuiSlider.java


示例20: mouseClick

import org.lwjgl.util.Point; //导入依赖的package包/类
@Override
public boolean mouseClick(ReadablePoint position, int button) {
    Point pos = new Point(position);
    if (getContainer() != null) {
        getContainer().convertFor(this, pos);
    }

    if (isMouseHovering(pos) && isEnabled()) {
        onClick();
        return true;
    }
    return false;
}
 
开发者ID:ReplayMod,项目名称:jGui,代码行数:14,代码来源:AbstractGuiClickable.java



注:本文中的org.lwjgl.util.Point类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java MalformedStreamDefinitionException类代码示例发布时间:2022-05-23
下一篇:
Java PngReader类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap