use of eidolons.libgdx.texture.SmartTextureAtlas in project Eidolons by IDemiurge.
the class HitAnim method resetSprites.
@Override
protected void resetSprites() {
sprites.clear();
spriteType = getSpriteType((BattleFieldObject) getRef().getTargetObj());
hitType = getHitType(getActive(), spriteType);
String spritePath = StrPathBuilder.build(getHitSpritesPath(), spriteType.name(), hitType.spritePath) + ".txt";
// + ".png";
// SpriteAnimation sprite = SpriteAnimationFactory.getSpriteAnimation(spritePath);
// scale?
SmartTextureAtlas atlas = SmartTextureAtlas.getAtlas(PathFinder.getImagePath() + spritePath);
if (atlas == null)
return;
Array<AtlasRegion> regions = atlas.getRegions();
SpriteAnimation sprite = SpriteAnimationFactory.getSpriteAnimation(regions, getDuration() / regions.size, 1);
if (getRef().getTargetObj() instanceof Unit)
sprite.setColor(getColorForSprite((Unit) getRef().getTargetObj()));
sprites.add(sprite);
}
use of eidolons.libgdx.texture.SmartTextureAtlas in project Eidolons by IDemiurge.
the class AnimMaster3d method getOrCreateAtlas.
public static TextureAtlas getOrCreateAtlas(String path) {
if (!FileManager.isFile(path))
return null;
path = TextureCache.formatTexturePath(path);
TextureAtlas atlas = atlasMap.get(path);
if (atlas == null) {
if (Assets.isOn()) {
Assets.get().getManager().load(path, TextureAtlas.class);
try {
Assets.get().getManager().finishLoadingAsset(path);
} catch (Exception e) {
main.system.ExceptionMaster.printStackTrace(e);
}
atlas = Assets.get().getManager().get(path, TextureAtlas.class);
} else {
atlas = new SmartTextureAtlas(path);
}
}
atlasMap.put(path, atlas);
return atlas;
}
Aggregations