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;
}
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];
}
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);
}
}
}
}
Aggregations