Search in sources :

Example 1 with FLIP

use of main.content.CONTENT_CONSTS.FLIP in project Eidolons by IDemiurge.

the class DrawMaster method getObjDrawImage.

private BufferedImage getObjDrawImage(Unit obj, boolean drawOverlays) {
    BufferedImage image;
    // image = objImageCache.getOrCreate(obj);
    // if (image != null)
    // return image;
    image = new BufferedImage(GuiManager.getFullObjSize(), GuiManager.getFullObjSize(), BufferedImage.TYPE_INT_ARGB);
    Graphics g = image.getGraphics();
    // Image img = ImageManager.getSizedVersion(obj.getIcon().getEmitterPath(),
    // new Dimension(objSize,
    // objSize));
    Image outlineImage = cellComp.getGame().getVisionMaster().getVisibilityMaster().getDisplayImageForUnit(obj);
    if (outlineImage != null) {
        g.drawImage(outlineImage, 0, 0, null);
        if (obj.isWall()) {
            drawWallOverlays(obj, g, cellComp.getCoordinates());
        }
    } else {
        Image objImage = obj.getIcon().getImage();
        g.drawImage(objImage, 0, 0, null);
    }
    if (obj.isUnconscious()) {
        image = ImageTransformer.getGrayScale(image);
    }
    FLIP flip = obj.getFlip();
    if (flip == null) {
    // Map<Unit, FLIP> map = obj.getGame().getFlipMap().get(cellComp.getCoordinates());
    // if (map != null) {
    // flip = map.get(obj);
    // }
    }
    if (flip != null) {
        image = ImageTransformer.flip(flip, image);
    }
    applyVisibility(image, obj);
    applyHighlights(image, obj);
    // if (drawOverlays)
    if (outlineImage == null) {
        try {
            if (obj.isInfoSelected()) {
                infoObjImage = new BufferedImage(GuiManager.getFullObjSize(), GuiManager.getFullObjSize(), BufferedImage.TYPE_INT_ARGB);
                g = infoObjImage.getGraphics();
                drawObjectOverlays(g, obj);
            } else if (obj.isActiveSelected()) {
                BufferedImage activeObjImage = new BufferedImage(GuiManager.getFullObjSize(), GuiManager.getFullObjSize(), BufferedImage.TYPE_INT_ARGB);
                g = activeObjImage.getGraphics();
                drawObjectOverlays(g, obj);
            } else // BfGridComp.getOverlayMap().put(key, value);
            {
                drawObjectOverlays(g, obj);
            }
        } catch (Exception e) {
            main.system.ExceptionMaster.printStackTrace(e);
        }
    }
    drawHeight(obj, g);
    g.dispose();
    objImageCache.put(obj, image);
    return image;
}
Also used : BufferedImage(java.awt.image.BufferedImage) FLIP(main.content.CONTENT_CONSTS.FLIP) BufferedImage(java.awt.image.BufferedImage)

Example 2 with FLIP

use of main.content.CONTENT_CONSTS.FLIP in project Eidolons by IDemiurge.

the class LE_ObjMaster method setFlip.

public static void setFlip(Unit obj, Coordinates c) {
    int i = DialogMaster.optionChoice("Set flip", FLIP.values());
    FLIP d;
    if (i == -1) {
        return;
    }
    d = FLIP.values()[i];
}
Also used : FLIP(main.content.CONTENT_CONSTS.FLIP)

Example 3 with FLIP

use of main.content.CONTENT_CONSTS.FLIP in project Eidolons by IDemiurge.

the class DC_ObjInitializer method initFlipMap.

public static void initFlipMap(int z, Map<String, FLIP> flipMap) {
    if (flipMap != null) {
        for (String data : flipMap.keySet()) {
            Coordinates c = getCoordinatesFromObjString(data);
            FLIP d = flipMap.get(data);
            for (BattleFieldObject obj : DC_Game.game.getObjectsOnCoordinate(z, c, null, false, false)) {
                String name = getNameFromObjString(data);
                if (name.contains(MULTI_DIRECTION_SUFFIX)) {
                    name = name.split(MULTI_DIRECTION_SUFFIX)[0];
                }
                if (!name.equals(obj.getName())) {
                    continue;
                }
                Map<BattleFieldObject, FLIP> map = obj.getGame().getFlipMap().get(c);
                if (map == null) {
                    map = new HashMap<>();
                    obj.getGame().getFlipMap().put(c, map);
                }
                map.put(obj, d);
            }
        }
    }
}
Also used : BattleFieldObject(eidolons.entity.obj.BattleFieldObject) ZCoordinates(main.game.bf.ZCoordinates) Coordinates(main.game.bf.Coordinates) FLIP(main.content.CONTENT_CONSTS.FLIP)

Aggregations

FLIP (main.content.CONTENT_CONSTS.FLIP)3 BattleFieldObject (eidolons.entity.obj.BattleFieldObject)1 BufferedImage (java.awt.image.BufferedImage)1 Coordinates (main.game.bf.Coordinates)1 ZCoordinates (main.game.bf.ZCoordinates)1