Package org.terasology.math

Examples of org.terasology.math.Vector2i


    }

    @Override
    public Vector2i getMaxContentSize(Canvas canvas) {
        Iterator<List<UIWidget>> columns = getColumnIterator();
        Vector2i size = new Vector2i();
        int[] rowSizes = new int[rows];
        while (columns.hasNext()) {
            List<UIWidget> column = columns.next();
            int columnWidth = 0;
            for (int i = 0; i < column.size(); ++i) {
                Vector2i maxSize = canvas.calculateMaximumSize(column.get(i));
                rowSizes[i] = Math.max(rowSizes[i], maxSize.y);
                columnWidth = Math.max(columnWidth, maxSize.x);
            }
            size.x = TeraMath.addClampAtMax(size.x, columnWidth);
            if (columns.hasNext()) {
View Full Code Here


        }
    };

    @Override
    public void onDraw(Canvas canvas) {
        int contentHeight = canvas.calculateRestrictedSize(content, new Vector2i(canvas.size().x, Integer.MAX_VALUE)).y;
        if (canvas.size().y < contentHeight) {
            int scrollbarWidth = canvas.calculateRestrictedSize(scrollbar, canvas.size()).x;
            contentHeight = canvas.calculateRestrictedSize(content, new Vector2i(canvas.size().x - scrollbarWidth, Integer.MAX_VALUE)).y;

            boolean atBottom = scrollbar.getRange() == scrollbar.getValue();

            Rect2i contentRegion = Rect2i.createFromMinAndSize(0, 0, canvas.size().x - scrollbarWidth, canvas.size().y);
            scrollbar.setRange(contentHeight - contentRegion.height());
View Full Code Here

        return canvas.calculatePreferredSize(content);
    }

    @Override
    public Vector2i getMaxContentSize(Canvas canvas) {
        return new Vector2i(Integer.MAX_VALUE, Integer.MAX_VALUE);
    }
View Full Code Here

    private T[] data;

    public BaseObjectFacet2D(Region3i targetRegion, Border3D border, Class<T> objectType) {
        super(targetRegion, border);
        Vector2i size = getRelativeRegion().size();
        this.data = (T[]) Array.newInstance(objectType, size.x * size.y);
    }
View Full Code Here

    private float[] data;

    public BaseFieldFacet2D(Region3i targetRegion, Border3D border) {
        super(targetRegion, border);
        Vector2i size = getRelativeRegion().size();
        this.data = new float[size.x * size.y];
    }
View Full Code Here

    @Override
    public Vector2i getPreferredContentSize(Canvas canvas, Vector2i sizeHint) {
        int[] bounds = {0, 0, canvas.size().x, canvas.size().y};
        layoutContainer(canvas, bounds);
        return new Vector2i(grid.getWidth()[1], grid.getHeight()[1]);
    }
View Full Code Here

    public void calculatePreferredSize(Canvas canvas, Vector2i sizeHint) {
        minimumSize = canvas.calculatePreferredSize(widget);
        minimumSize.x = Math.min(sizeHint.x, minimumSize.x);
        minimumSize.y = Math.min(sizeHint.y, minimumSize.y);
        preferredSize = new Vector2i(Math.max(sizeHint.x, minimumSize.x), Math.max(sizeHint.y, minimumSize.y));
    }
View Full Code Here

        addInputSection(inputCategories.remove("engine:inventory"), mainLayout, inputsById);
        addInputSection(inputCategories.remove("engine:general"), mainLayout, inputsById);
        for (InputCategory category : inputCategories.values()) {
            addInputSection(category, mainLayout, inputsById);
        }
        mainLayout.addWidget(new UISpace(new Vector2i(1, 16)));

        ScrollableArea area = new ScrollableArea();
        area.setContent(mainLayout);
        //area.setContentHeight(mainLayout.getRowCount() * 32);

 
View Full Code Here

        setContents(layout);
    }

    private void addInputSection(InputCategory category, ColumnLayout layout, Map<SimpleUri, RegisterBindButton> inputsById) {
        if (category != null) {
            layout.addWidget(new UISpace(new Vector2i(0, 16)));

            UILabel categoryHeader = new UILabel(category.displayName());
            categoryHeader.setFamily("heading-input");
            layout.addWidget(categoryHeader);
View Full Code Here

        return textureData.getHeight();
    }

    @Override
    public Vector2i size() {
        return new Vector2i(getWidth(), getHeight());
    }
View Full Code Here

TOP

Related Classes of org.terasology.math.Vector2i

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.