Search in sources :

Example 1 with PointX

use of main.swing.PointX in project Eidolons by IDemiurge.

the class HT_MapBuilder method getNodePointFromLink.

private Point getNodePointFromLink(int parentX, ObjType type, int i, int sublingCount, ObjType parent, StaticTreeLink link) {
    Point point;
    LINK_VARIANT variant = link.getVariant();
    point = link.getPoint();
    Point originalPoint = new Point(point.x, point.y);
    boolean adjusted = false;
    if (isAutoAdjustmentOn()) {
        if (parent != null) {
            while (adjustLink(point, link, parent, type, parentX, i, sublingCount)) {
                // link point or node point?
                adjusted = true;
                point = new PointX(link.getPoint().x + variant.getNodeOffsetX(), link.getPoint().y - // getPoint(link.getVariant(),
                64);
            // parent, type, parentX, i,
            // sublingCount); //
            // unnecessary?
            }
        }
    }
    if (adjusted) {
        LogMaster.log(1, "^v^ " + type.getName() + " adjusted to " + variant + " from " + link.getVariant());
        LogMaster.log(1, "^v^ " + type.getName() + " adjusted to " + point + " from " + originalPoint);
        variant = link.getVariant();
        map.getStaticLinkMap().put(link, getPoint(variant, parent, type, parentX, i, sublingCount));
    }
    // +getGroupNodeOffsetX(type,
    int x = point.x + variant.getNodeOffsetX();
    // link.getChildren());
    if (!isAddLinkPerChild()) {
        if (link.getVariant().isVertical() || (!link.isManualSet())) {
            x = getX(parentX, i, sublingCount, type, parent);
        }
    }
    // + variant.getNodeOffsetY();
    int y = point.y - 64;
    Point groupNodeOffset = groupNodePosMap.get(type);
    if (groupNodeOffset != null) {
        x += groupNodeOffset.x;
        y += groupNodeOffset.y;
    }
    x += type.getIntParam(PARAMS.TREE_NODE_OFFSET_X);
    y += type.getIntParam(PARAMS.TREE_NODE_OFFSET_Y);
    int finalX = MathMaster.getMinMax(x, 0, defTreeWidth - 64);
    int finalY = MathMaster.getMinMax(y, 0, defTreeHeight - 64);
    // int diffY = finalY-y;
    int abs = Math.abs(finalX - x);
    if (!customPos) {
        if (abs > 0) {
            if (finalY == y) {
                // just limit the diff!
                LogMaster.log(1, type.getName() + " (x adjustment) -> Y decreased by " + abs);
                // increase or decrease Y for x-change?
                finalY += abs;
            }
        }
    }
    point = new PointX(finalX, finalY);
    return point;
}
Also used : LINK_VARIANT(eidolons.client.cc.gui.neo.tree.logic.TreeMap.LINK_VARIANT) PointX(main.swing.PointX)

Example 2 with PointX

use of main.swing.PointX in project Eidolons by IDemiurge.

the class HT_MapBuilder method getTypesWithinRange.

public List<ObjType> getTypesWithinRange(ObjType type, int i, int sublingCount, int xMaxRange, int yMaxRange) {
    ObjType parent = DataManager.getParent(type);
    int y1 = getY(type, parent);
    Point pointForType = // TODO
    parent == null ? // TODO
    new PointX(getX(0, i, sublingCount, type, parent), y1) : // ???
    map.getPointForType(parent);
    int x1 = getX(pointForType.x, i, sublingCount, type, parent);
    return map.getTypesWithinRange(type, i, sublingCount, x1, y1, xMaxRange, yMaxRange);
}
Also used : ObjType(main.entity.type.ObjType) PointX(main.swing.PointX)

Example 3 with PointX

use of main.swing.PointX in project Eidolons by IDemiurge.

the class TreeMap method addNode.

public void addNode(Point point, HT_Node node, int size) {
    HT_Node replaced = getNodeMap().put(new PointX(point.x, point.y), node);
    if (replaced != null) {
        LogMaster.log(1, " !!! " + node + " replaces " + replaced + " !!! ");
    }
    getMouseMap().put(new Rectangle(point.x, point.y, size, size), node);
}
Also used : HT_Node(eidolons.client.cc.gui.neo.tree.HT_Node) PointX(main.swing.PointX)

Example 4 with PointX

use of main.swing.PointX in project Eidolons by IDemiurge.

the class HT_MapBuilder method addAltBaseLinks.

private void addAltBaseLinks() {
    for (HT_Node c : map.getNodeMap().values()) {
        String prop = c.getType().getProperty(PROPS.ALT_BASE_LINKS);
        if (prop.isEmpty()) {
            continue;
        }
        for (String s : StringMaster.open(prop)) {
            String typeName = VariableManager.removeVarPart(s);
            String vars = VariableManager.getVar(s);
            LINK_VARIANT variant = new EnumMaster<LINK_VARIANT>().retrieveEnumConst(LINK_VARIANT.class, vars.split("=")[0]);
            ObjType targetType = DataManager.getType(typeName, getTYPE());
            Point point = map.getPointForType(c.getType());
            // getPoint(variant, parent, type, parentX, i, sublingCount)
            // point = getNodePointFromLink(point2.x, targetType, 0, 0,
            // c.getType(), variant);
            /*
                 * use the variant.getOffset()
				 *
				 * what point is base?
				 *
				 * c.
				 *
				 */
            int offsetX = StringMaster.getInteger(vars.split("=")[1].split(",")[0]);
            int offsetY = StringMaster.getInteger(vars.split("=")[1].split(",")[1]);
            point = new PointX(point.x + offsetX, point.y + offsetY);
            StaticTreeLink link = new StaticTreeLink(variant, point, targetType, c.getType());
            // link.setAlt(true); // what will it do?
            map.getAltLinks().put(link, targetType);
        }
    }
}
Also used : HT_Node(eidolons.client.cc.gui.neo.tree.HT_Node) ObjType(main.entity.type.ObjType) LINK_VARIANT(eidolons.client.cc.gui.neo.tree.logic.TreeMap.LINK_VARIANT) PointX(main.swing.PointX)

Example 5 with PointX

use of main.swing.PointX in project Eidolons by IDemiurge.

the class PhaseAnimListener method scrolled.

@Override
public boolean scrolled(InputEvent event, float x, float y, int amount) {
    if (anim.contains(new PointX(x, y))) {
        if (anim.isWheelSupported()) {
            if (anim.isManualFlippingSupported()) {
                boolean forward = amount < 0;
                anim.pageFlipped(forward);
                return true;
            }
        }
    }
    return false;
}
Also used : PointX(main.swing.PointX)

Aggregations

PointX (main.swing.PointX)6 HT_Node (eidolons.client.cc.gui.neo.tree.HT_Node)3 LINK_VARIANT (eidolons.client.cc.gui.neo.tree.logic.TreeMap.LINK_VARIANT)2 ObjType (main.entity.type.ObjType)2