Search in sources :

Example 1 with SmartTextureAtlas

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);
}
Also used : BattleFieldObject(eidolons.entity.obj.BattleFieldObject) SmartTextureAtlas(eidolons.libgdx.texture.SmartTextureAtlas) SpriteAnimation(eidolons.libgdx.anims.sprite.SpriteAnimation) AtlasRegion(com.badlogic.gdx.graphics.g2d.TextureAtlas.AtlasRegion) Unit(eidolons.entity.obj.unit.Unit)

Example 2 with SmartTextureAtlas

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;
}
Also used : SmartTextureAtlas(eidolons.libgdx.texture.SmartTextureAtlas) TextureAtlas(com.badlogic.gdx.graphics.g2d.TextureAtlas) SmartTextureAtlas(eidolons.libgdx.texture.SmartTextureAtlas)

Aggregations

SmartTextureAtlas (eidolons.libgdx.texture.SmartTextureAtlas)2 TextureAtlas (com.badlogic.gdx.graphics.g2d.TextureAtlas)1 AtlasRegion (com.badlogic.gdx.graphics.g2d.TextureAtlas.AtlasRegion)1 BattleFieldObject (eidolons.entity.obj.BattleFieldObject)1 Unit (eidolons.entity.obj.unit.Unit)1 SpriteAnimation (eidolons.libgdx.anims.sprite.SpriteAnimation)1