com.badlogic.gdx.graphics.g2d.TextureAtlas Java Examples

The following examples show how to use com.badlogic.gdx.graphics.g2d.TextureAtlas. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: Assets.java    From ud406 with MIT License 6 votes vote down vote up
public GigaGalAssets(TextureAtlas atlas) {
    standingLeft = atlas.findRegion(Constants.STANDING_LEFT);
    standingRight = atlas.findRegion(Constants.STANDING_RIGHT);
    walkingLeft = atlas.findRegion(Constants.WALKING_LEFT_2);
    walkingRight = atlas.findRegion(Constants.WALKING_RIGHT_2);

    jumpingLeft = atlas.findRegion(Constants.JUMPING_LEFT);
    jumpingRight = atlas.findRegion(Constants.JUMPING_RIGHT);

    Array<AtlasRegion> walkingLeftFrames = new Array<AtlasRegion>();
    walkingLeftFrames.add(atlas.findRegion(Constants.WALKING_LEFT_2));
    walkingLeftFrames.add(atlas.findRegion(Constants.WALKING_LEFT_1));
    walkingLeftFrames.add(atlas.findRegion(Constants.WALKING_LEFT_2));
    walkingLeftFrames.add(atlas.findRegion(Constants.WALKING_LEFT_3));
    walkingLeftAnimation = new Animation(Constants.WALK_LOOP_DURATION, walkingLeftFrames, PlayMode.LOOP);

    Array<AtlasRegion> walkingRightFrames = new Array<AtlasRegion>();
    walkingRightFrames.add(atlas.findRegion(Constants.WALKING_RIGHT_2));
    walkingRightFrames.add(atlas.findRegion(Constants.WALKING_RIGHT_1));
    walkingRightFrames.add(atlas.findRegion(Constants.WALKING_RIGHT_2));
    walkingRightFrames.add(atlas.findRegion(Constants.WALKING_RIGHT_3));
    walkingRightAnimation = new Animation(Constants.WALK_LOOP_DURATION, walkingRightFrames, PlayMode.LOOP);
}
 
Example #2
Source File: TalosAssetProvider.java    From talos with Apache License 2.0 6 votes vote down vote up
public Sprite replaceRegion (FileHandle handle) {
	Texture texture = new Texture(handle);
	final Sprite textureRegion = new Sprite(texture);

	final Array<TextureAtlas.AtlasRegion> regions = atlas.getRegions();

	for (int i = 0; i < regions.size; i++) {
		if (regions.get(i).name.equalsIgnoreCase(handle.nameWithoutExtension())) {
			regions.removeIndex(i);
			break;
		}
	}

	atlas.addRegion(handle.nameWithoutExtension(), textureRegion);

	return textureRegion;
}
 
Example #3
Source File: StaticMemoryInfo.java    From jorbs-spire-mod with MIT License 6 votes vote down vote up
private <T extends AbstractMemory> StaticMemoryInfo(Class<T> memoryClass) {
    CLASS = memoryClass;
    ID = JorbsMod.makeID(memoryClass.getSimpleName());
    PowerStrings powerStrings = CardCrawlGame.languagePack.getPowerStrings(ID);
    NAME = powerStrings.NAME;
    DESCRIPTIONS = powerStrings.DESCRIPTIONS;

    String imageFilenamePrefix = memoryClass.getSimpleName().replace("Memory","");
    CLARITY_TEXTURE_84 = TextureLoader.getTexture(makeMemoryPath("c" + imageFilenamePrefix + "_84.png"));
    CLARITY_TEXTURE_48 = TextureLoader.getTexture(makeMemoryPath("c" + imageFilenamePrefix + "_48.png"));
    EMPTY_TEXTURE_84 = TextureLoader.getTexture(makeMemoryPath("e" + imageFilenamePrefix + "_84.png"));
    EMPTY_TEXTURE_48 = TextureLoader.getTexture(makeMemoryPath("e" + imageFilenamePrefix + "_48.png"));
    REMEMBER_TEXTURE_84 = TextureLoader.getTexture(makeMemoryPath("r" + imageFilenamePrefix + "_84.png"));
    REMEMBER_TEXTURE_48 = TextureLoader.getTexture(makeMemoryPath("r" + imageFilenamePrefix + "_48.png"));

    CLARITY_IMG_84 = new TextureAtlas.AtlasRegion(CLARITY_TEXTURE_84, 0, 0, 84, 84);
    CLARITY_IMG_48 = new TextureAtlas.AtlasRegion(CLARITY_TEXTURE_48, 0, 0, 48, 48);
    EMPTY_IMG_84 = new TextureAtlas.AtlasRegion(EMPTY_TEXTURE_84, 0, 0, 84, 84);
    EMPTY_IMG_48 = new TextureAtlas.AtlasRegion(EMPTY_TEXTURE_48, 0, 0, 48, 48);
    REMEMBER_IMG_84 = new TextureAtlas.AtlasRegion(REMEMBER_TEXTURE_84, 0, 0, 84, 84);
    REMEMBER_IMG_48 = new TextureAtlas.AtlasRegion(REMEMBER_TEXTURE_48, 0, 0, 48, 48);
}
 
Example #4
Source File: Assets.java    From ud406 with MIT License 6 votes vote down vote up
public GigaGalAssets(TextureAtlas atlas) {
    standingLeft = atlas.findRegion(Constants.STANDING_LEFT);
    standingRight = atlas.findRegion(Constants.STANDING_RIGHT);
    walkingLeft = atlas.findRegion(Constants.WALKING_LEFT_2);
    walkingRight = atlas.findRegion(Constants.WALKING_RIGHT_2);

    jumpingLeft = atlas.findRegion(Constants.JUMPING_LEFT);
    jumpingRight = atlas.findRegion(Constants.JUMPING_RIGHT);

    Array<AtlasRegion> walkingLeftFrames = new Array<AtlasRegion>();
    walkingLeftFrames.add(atlas.findRegion(Constants.WALKING_LEFT_2));
    walkingLeftFrames.add(atlas.findRegion(Constants.WALKING_LEFT_1));
    walkingLeftFrames.add(atlas.findRegion(Constants.WALKING_LEFT_2));
    walkingLeftFrames.add(atlas.findRegion(Constants.WALKING_LEFT_3));
    walkingLeftAnimation = new Animation(Constants.WALK_LOOP_DURATION, walkingLeftFrames, PlayMode.LOOP);

    Array<AtlasRegion> walkingRightFrames = new Array<AtlasRegion>();
    walkingRightFrames.add(atlas.findRegion(Constants.WALKING_RIGHT_2));
    walkingRightFrames.add(atlas.findRegion(Constants.WALKING_RIGHT_1));
    walkingRightFrames.add(atlas.findRegion(Constants.WALKING_RIGHT_2));
    walkingRightFrames.add(atlas.findRegion(Constants.WALKING_RIGHT_3));
    walkingRightAnimation = new Animation(Constants.WALK_LOOP_DURATION, walkingRightFrames, PlayMode.LOOP);
}
 
Example #5
Source File: Assets.java    From ud406 with MIT License 6 votes vote down vote up
public GigaGalAssets(TextureAtlas atlas) {
    standingLeft = atlas.findRegion(Constants.STANDING_LEFT);
    standingRight = atlas.findRegion(Constants.STANDING_RIGHT);
    walkingLeft = atlas.findRegion(Constants.WALKING_LEFT_2);
    walkingRight = atlas.findRegion(Constants.WALKING_RIGHT_2);

    jumpingLeft = atlas.findRegion(Constants.JUMPING_LEFT);
    jumpingRight = atlas.findRegion(Constants.JUMPING_RIGHT);

    Array<AtlasRegion> walkingLeftFrames = new Array<AtlasRegion>();
    walkingLeftFrames.add(atlas.findRegion(Constants.WALKING_LEFT_2));
    walkingLeftFrames.add(atlas.findRegion(Constants.WALKING_LEFT_1));
    walkingLeftFrames.add(atlas.findRegion(Constants.WALKING_LEFT_2));
    walkingLeftFrames.add(atlas.findRegion(Constants.WALKING_LEFT_3));
    walkingLeftAnimation = new Animation(Constants.WALK_LOOP_DURATION, walkingLeftFrames, PlayMode.LOOP);

    Array<AtlasRegion> walkingRightFrames = new Array<AtlasRegion>();
    walkingRightFrames.add(atlas.findRegion(Constants.WALKING_RIGHT_2));
    walkingRightFrames.add(atlas.findRegion(Constants.WALKING_RIGHT_1));
    walkingRightFrames.add(atlas.findRegion(Constants.WALKING_RIGHT_2));
    walkingRightFrames.add(atlas.findRegion(Constants.WALKING_RIGHT_3));
    walkingRightAnimation = new Animation(Constants.WALK_LOOP_DURATION, walkingRightFrames, PlayMode.LOOP);
}
 
Example #6
Source File: TalosAssetProvider.java    From talos with Apache License 2.0 6 votes vote down vote up
private TextureRegion findRegionOrLoad (String assetName) {
	final TextureAtlas.AtlasRegion region = atlas.findRegion(assetName);
	if (region == null) {
		//Look in all paths, and hopefully load the requested asset, or fail (crash)
		//if has extension remove it
		if(assetName.contains(".")) {
			assetName = assetName.substring(0, assetName.lastIndexOf("."));
		}
		FileHandle file = findFile(assetName);
		if (file == null || !file.exists()) {
			//throw new GdxRuntimeException("No region found for: " + assetName + " from provider");
			// try the tracker first
			file = TalosMain.Instance().FileTracker().findFileByName(assetName + ".png");
			if(file == null) {
				return null;
			}
		}
		Texture texture = new Texture(file);
		TextureRegion textureRegion = new TextureRegion(texture);
		atlas.addRegion(assetName, textureRegion);
		return textureRegion;
	}
	return region;
}
 
Example #7
Source File: Assets.java    From ud406 with MIT License 6 votes vote down vote up
public void init(AssetManager assetManager) {
    this.assetManager = assetManager;
    assetManager.setErrorListener(this);
    assetManager.load(Constants.TEXTURE_ATLAS, TextureAtlas.class);
    assetManager.finishLoading();

    TextureAtlas atlas = assetManager.get(Constants.TEXTURE_ATLAS);
    gigaGalAssets = new GigaGalAssets(atlas);
    platformAssets = new PlatformAssets(atlas);
    bulletAssets = new BulletAssets(atlas);
    enemyAssets = new EnemyAssets(atlas);
    explosionAssets = new ExplosionAssets(atlas);
    powerupAssets = new PowerupAssets(atlas);
    exitPortalAssets = new ExitPortalAssets(atlas);
    onscreenControlsAssets = new OnscreenControlsAssets(atlas);
}
 
Example #8
Source File: Assets.java    From ud406 with MIT License 6 votes vote down vote up
public GigaGalAssets(TextureAtlas atlas) {
    standingLeft = atlas.findRegion(Constants.STANDING_LEFT);
    standingRight = atlas.findRegion(Constants.STANDING_RIGHT);
    walkingLeft = atlas.findRegion(Constants.WALKING_LEFT_2);
    walkingRight = atlas.findRegion(Constants.WALKING_RIGHT_2);

    jumpingLeft = atlas.findRegion(Constants.JUMPING_LEFT);
    jumpingRight = atlas.findRegion(Constants.JUMPING_RIGHT);

    Array<AtlasRegion> walkingLeftFrames = new Array<AtlasRegion>();
    walkingLeftFrames.add(atlas.findRegion(Constants.WALKING_LEFT_2));
    walkingLeftFrames.add(atlas.findRegion(Constants.WALKING_LEFT_1));
    walkingLeftFrames.add(atlas.findRegion(Constants.WALKING_LEFT_2));
    walkingLeftFrames.add(atlas.findRegion(Constants.WALKING_LEFT_3));
    walkingLeftAnimation = new Animation(Constants.WALK_LOOP_DURATION, walkingLeftFrames, PlayMode.LOOP);

    Array<AtlasRegion> walkingRightFrames = new Array<AtlasRegion>();
    walkingRightFrames.add(atlas.findRegion(Constants.WALKING_RIGHT_2));
    walkingRightFrames.add(atlas.findRegion(Constants.WALKING_RIGHT_1));
    walkingRightFrames.add(atlas.findRegion(Constants.WALKING_RIGHT_2));
    walkingRightFrames.add(atlas.findRegion(Constants.WALKING_RIGHT_3));
    walkingRightAnimation = new Animation(Constants.WALK_LOOP_DURATION, walkingRightFrames, PlayMode.LOOP);
}
 
Example #9
Source File: RarePower.java    From StS-DefaultModBase with MIT License 6 votes vote down vote up
public RarePower(final AbstractCreature owner, final AbstractCreature source, final int amount) {
    name = NAME;
    ID = POWER_ID;

    this.owner = owner;
    this.amount = amount;
    this.source = source;

    type = PowerType.DEBUFF;
    isTurnBased = false;

    // We load those textures here.
    this.region128 = new TextureAtlas.AtlasRegion(tex84, 0, 0, 84, 84);
    this.region48 = new TextureAtlas.AtlasRegion(tex32, 0, 0, 32, 32);

    updateDescription();
}
 
Example #10
Source File: CommonPower.java    From StS-DefaultModBase with MIT License 6 votes vote down vote up
public CommonPower(final AbstractCreature owner, final AbstractCreature source, final int amount) {
    name = NAME;
    ID = POWER_ID;

    this.owner = owner;
    this.amount = amount;
    this.source = source;

    type = PowerType.BUFF;
    isTurnBased = false;

    // We load those txtures here.
    this.region128 = new TextureAtlas.AtlasRegion(tex84, 0, 0, 84, 84);
    this.region48 = new TextureAtlas.AtlasRegion(tex32, 0, 0, 32, 32);

    updateDescription();
}
 
Example #11
Source File: TeleportVisualizer.java    From dice-heroes with GNU General Public License v3.0 6 votes vote down vote up
private Array<TextureAtlas.AtlasRegion> compose(String name) {
    Array<TextureAtlas.AtlasRegion> result = composes.get(name);
    if (result == null) {
        result = new Array<TextureAtlas.AtlasRegion>(Config.findRegions(name));
        Array<TextureAtlas.AtlasRegion> rev = new Array<TextureAtlas.AtlasRegion>(result);
        rev.pop();
        rev.reverse();
        for (int i = 0; i < 1; i++) {
            result.add(result.get(result.size - 2));
            result.add(result.get(result.size - 2));
        }
        result.addAll(rev);
        composes.put(name, result);
    }
    return result;
}
 
Example #12
Source File: Assets.java    From ud406 with MIT License 6 votes vote down vote up
public GigaGalAssets(TextureAtlas atlas) {
    standingLeft = atlas.findRegion(Constants.STANDING_LEFT);
    standingRight = atlas.findRegion(Constants.STANDING_RIGHT);
    walkingLeft = atlas.findRegion(Constants.WALKING_LEFT_2);
    walkingRight = atlas.findRegion(Constants.WALKING_RIGHT_2);

    jumpingLeft = atlas.findRegion(Constants.JUMPING_LEFT);
    jumpingRight = atlas.findRegion(Constants.JUMPING_RIGHT);

    Array<AtlasRegion> walkingLeftFrames = new Array<AtlasRegion>();
    walkingLeftFrames.add(atlas.findRegion(Constants.WALKING_LEFT_2));
    walkingLeftFrames.add(atlas.findRegion(Constants.WALKING_LEFT_1));
    walkingLeftFrames.add(atlas.findRegion(Constants.WALKING_LEFT_2));
    walkingLeftFrames.add(atlas.findRegion(Constants.WALKING_LEFT_3));
    walkingLeftAnimation = new Animation(Constants.WALK_LOOP_DURATION, walkingLeftFrames, PlayMode.LOOP);

    Array<AtlasRegion> walkingRightFrames = new Array<AtlasRegion>();
    walkingRightFrames.add(atlas.findRegion(Constants.WALKING_RIGHT_2));
    walkingRightFrames.add(atlas.findRegion(Constants.WALKING_RIGHT_1));
    walkingRightFrames.add(atlas.findRegion(Constants.WALKING_RIGHT_2));
    walkingRightFrames.add(atlas.findRegion(Constants.WALKING_RIGHT_3));
    walkingRightAnimation = new Animation(Constants.WALK_LOOP_DURATION, walkingRightFrames, PlayMode.LOOP);
}
 
Example #13
Source File: FileSizeMetadataProcessor.java    From gdx-texture-packer-gui with Apache License 2.0 6 votes vote down vote up
@Override
public void processPackage(PackProcessingNode node) throws Exception {
    PackModel pack = node.getPack();
    ProjectModel project = node.getProject();

    FileHandle packFileHandle = Gdx.files.absolute(pack.getOutputDir()).child(pack.getCanonicalFilename());
    FileHandle imagesDirFileHandle = Gdx.files.absolute(pack.getOutputDir());
    TextureAtlas.TextureAtlasData atlasData = new TextureAtlas.TextureAtlasData(
            packFileHandle,
            imagesDirFileHandle,
            false);

    long totalSize = 0; // Bytes
    totalSize += packFileHandle.length();
    for (TextureAtlas.TextureAtlasData.Page page : atlasData.getPages()) {
        long pageSize = page.textureFile.length();
        totalSize += pageSize;
    }
    node.addMetadata(PackProcessingNode.META_FILE_SIZE, totalSize);

    System.out.println("Total pack files size is " + totalSize + " bytes");
}
 
Example #14
Source File: Assets.java    From ud406 with MIT License 6 votes vote down vote up
public GigaGalAssets(TextureAtlas atlas) {
    standingLeft = atlas.findRegion(Constants.STANDING_LEFT);
    standingRight = atlas.findRegion(Constants.STANDING_RIGHT);
    walkingLeft = atlas.findRegion(Constants.WALKING_LEFT_2);
    walkingRight = atlas.findRegion(Constants.WALKING_RIGHT_2);

    jumpingLeft = atlas.findRegion(Constants.JUMPING_LEFT);
    jumpingRight = atlas.findRegion(Constants.JUMPING_RIGHT);

    Array<AtlasRegion> walkingLeftFrames = new Array<AtlasRegion>();
    walkingLeftFrames.add(atlas.findRegion(Constants.WALKING_LEFT_2));
    walkingLeftFrames.add(atlas.findRegion(Constants.WALKING_LEFT_1));
    walkingLeftFrames.add(atlas.findRegion(Constants.WALKING_LEFT_2));
    walkingLeftFrames.add(atlas.findRegion(Constants.WALKING_LEFT_3));
    walkingLeftAnimation = new Animation(Constants.WALK_LOOP_DURATION, walkingLeftFrames, PlayMode.LOOP);

    Array<AtlasRegion> walkingRightFrames = new Array<AtlasRegion>();
    walkingRightFrames.add(atlas.findRegion(Constants.WALKING_RIGHT_2));
    walkingRightFrames.add(atlas.findRegion(Constants.WALKING_RIGHT_1));
    walkingRightFrames.add(atlas.findRegion(Constants.WALKING_RIGHT_2));
    walkingRightFrames.add(atlas.findRegion(Constants.WALKING_RIGHT_3));
    walkingRightAnimation = new Animation(Constants.WALK_LOOP_DURATION, walkingRightFrames, PlayMode.LOOP);
}
 
Example #15
Source File: Assets.java    From ud406 with MIT License 6 votes vote down vote up
public GigaGalAssets(TextureAtlas atlas) {
    standingLeft = atlas.findRegion(Constants.STANDING_LEFT);
    standingRight = atlas.findRegion(Constants.STANDING_RIGHT);
    walkingLeft = atlas.findRegion(Constants.WALKING_LEFT_2);
    walkingRight = atlas.findRegion(Constants.WALKING_RIGHT_2);

    jumpingLeft = atlas.findRegion(Constants.JUMPING_LEFT);
    jumpingRight = atlas.findRegion(Constants.JUMPING_RIGHT);

    Array<AtlasRegion> walkingLeftFrames = new Array<AtlasRegion>();
    walkingLeftFrames.add(atlas.findRegion(Constants.WALKING_LEFT_2));
    walkingLeftFrames.add(atlas.findRegion(Constants.WALKING_LEFT_1));
    walkingLeftFrames.add(atlas.findRegion(Constants.WALKING_LEFT_2));
    walkingLeftFrames.add(atlas.findRegion(Constants.WALKING_LEFT_3));
    walkingLeftAnimation = new Animation(Constants.WALK_LOOP_DURATION, walkingLeftFrames, PlayMode.LOOP);

    Array<AtlasRegion> walkingRightFrames = new Array<AtlasRegion>();
    walkingRightFrames.add(atlas.findRegion(Constants.WALKING_RIGHT_2));
    walkingRightFrames.add(atlas.findRegion(Constants.WALKING_RIGHT_1));
    walkingRightFrames.add(atlas.findRegion(Constants.WALKING_RIGHT_2));
    walkingRightFrames.add(atlas.findRegion(Constants.WALKING_RIGHT_3));
    walkingRightAnimation = new Animation(Constants.WALK_LOOP_DURATION, walkingRightFrames, PlayMode.LOOP);
}
 
Example #16
Source File: GraphicWidget.java    From skin-composer with MIT License 6 votes vote down vote up
public GraphicWidget(Skin skin) {
    super(skin);
    
    mode = Mode.START;
    
    setTouchable(Touchable.disabled);
    
    SkeletonJson skeletonJson = new SkeletonJson(new TextureAtlas(Gdx.files.internal("ui/skin-composer-installer-ui.atlas")));
    SkeletonRenderer skeletonRenderer = new SkeletonRenderer();
    skeletonRenderer.setPremultipliedAlpha(false);
    
    SpineDrawableTemplate template = new SpineDrawableTemplate();
    template.internalPath = Gdx.files.internal("ui/progress-bar.json");
    template.widthBones = new Array<>(new String[] {"resizer"});
    template.heightBones = new Array<>(new String[] {"resizer"});
    
    spineDrawable = new SpineDrawable(skeletonJson, skeletonRenderer, template);
    spineDrawable.getAnimationState().getData().setDefaultMix(0);
}
 
Example #17
Source File: Assets.java    From ud406 with MIT License 6 votes vote down vote up
public GigaGalAssets(TextureAtlas atlas) {
    standingLeft = atlas.findRegion(Constants.STANDING_LEFT);
    standingRight = atlas.findRegion(Constants.STANDING_RIGHT);
    walkingLeft = atlas.findRegion(Constants.WALKING_LEFT_2);
    walkingRight = atlas.findRegion(Constants.WALKING_RIGHT_2);

    jumpingLeft = atlas.findRegion(Constants.JUMPING_LEFT);
    jumpingRight = atlas.findRegion(Constants.JUMPING_RIGHT);

    Array<AtlasRegion> walkingLeftFrames = new Array<AtlasRegion>();
    walkingLeftFrames.add(atlas.findRegion(Constants.WALKING_LEFT_2));
    walkingLeftFrames.add(atlas.findRegion(Constants.WALKING_LEFT_1));
    walkingLeftFrames.add(atlas.findRegion(Constants.WALKING_LEFT_2));
    walkingLeftFrames.add(atlas.findRegion(Constants.WALKING_LEFT_3));
    walkingLeftAnimation = new Animation(Constants.WALK_LOOP_DURATION, walkingLeftFrames, PlayMode.LOOP);

    Array<AtlasRegion> walkingRightFrames = new Array<AtlasRegion>();
    walkingRightFrames.add(atlas.findRegion(Constants.WALKING_RIGHT_2));
    walkingRightFrames.add(atlas.findRegion(Constants.WALKING_RIGHT_1));
    walkingRightFrames.add(atlas.findRegion(Constants.WALKING_RIGHT_2));
    walkingRightFrames.add(atlas.findRegion(Constants.WALKING_RIGHT_3));
    walkingRightAnimation = new Animation(Constants.WALK_LOOP_DURATION, walkingRightFrames, PlayMode.LOOP);
}
 
Example #18
Source File: Assets.java    From ud406 with MIT License 6 votes vote down vote up
public GigaGalAssets(TextureAtlas atlas) {
    standingLeft = atlas.findRegion(Constants.STANDING_LEFT);
    standingRight = atlas.findRegion(Constants.STANDING_RIGHT);
    walkingLeft = atlas.findRegion(Constants.WALKING_LEFT_2);
    walkingRight = atlas.findRegion(Constants.WALKING_RIGHT_2);

    jumpingLeft = atlas.findRegion(Constants.JUMPING_LEFT);
    jumpingRight = atlas.findRegion(Constants.JUMPING_RIGHT);

    Array<AtlasRegion> walkingLeftFrames = new Array<AtlasRegion>();
    walkingLeftFrames.add(atlas.findRegion(Constants.WALKING_LEFT_2));
    walkingLeftFrames.add(atlas.findRegion(Constants.WALKING_LEFT_1));
    walkingLeftFrames.add(atlas.findRegion(Constants.WALKING_LEFT_2));
    walkingLeftFrames.add(atlas.findRegion(Constants.WALKING_LEFT_3));
    walkingLeftAnimation = new Animation(Constants.WALK_LOOP_DURATION, walkingLeftFrames, PlayMode.LOOP);

    Array<AtlasRegion> walkingRightFrames = new Array<AtlasRegion>();
    walkingRightFrames.add(atlas.findRegion(Constants.WALKING_RIGHT_2));
    walkingRightFrames.add(atlas.findRegion(Constants.WALKING_RIGHT_1));
    walkingRightFrames.add(atlas.findRegion(Constants.WALKING_RIGHT_2));
    walkingRightFrames.add(atlas.findRegion(Constants.WALKING_RIGHT_3));
    walkingRightAnimation = new Animation(Constants.WALK_LOOP_DURATION, walkingRightFrames, PlayMode.LOOP);
}
 
Example #19
Source File: PageAmountMetadataProcessor.java    From gdx-texture-packer-gui with Apache License 2.0 6 votes vote down vote up
@Override
public void processPackage(PackProcessingNode node) throws Exception {
    PackModel pack = node.getPack();
    ProjectModel project = node.getProject();

    FileHandle packFileHandle = Gdx.files.absolute(pack.getOutputDir()).child(pack.getCanonicalFilename());
    FileHandle imagesDirFileHandle = Gdx.files.absolute(pack.getOutputDir());
    TextureAtlas.TextureAtlasData atlasData = new TextureAtlas.TextureAtlasData(
            packFileHandle,
            imagesDirFileHandle,
            false);

    int pageAmount = atlasData.getPages().size;
    node.addMetadata(PackProcessingNode.META_ATLAS_PAGES, pageAmount);
    System.out.println(pageAmount + " pages");
}
 
Example #20
Source File: ViewController.java    From dice-heroes with GNU General Public License v3.0 5 votes vote down vote up
public static Image addBottomRightCornerTransition(String name, int x, int y, Group layer) {
    TextureAtlas.AtlasRegion region = Config.findRegions("transitions/" + name + "-corner").random();
    if (region == null)
        return null;
    Image image = new Image(region);
    layer.addActor(image);
    image.setRotation(180);
    image.setPosition((x + 1) * CELL_SIZE, (y + 1) * CELL_SIZE);
    return image;
}
 
Example #21
Source File: Assets.java    From ud406 with MIT License 5 votes vote down vote up
public void init(AssetManager assetManager) {
    this.assetManager = assetManager;
    assetManager.setErrorListener(this);
    assetManager.load(Constants.TEXTURE_ATLAS, TextureAtlas.class);
    assetManager.finishLoading();

    TextureAtlas atlas = assetManager.get(Constants.TEXTURE_ATLAS);
    gigaGalAssets = new GigaGalAssets(atlas);
    platformAssets = new PlatformAssets(atlas);
}
 
Example #22
Source File: ViewController.java    From dice-heroes with GNU General Public License v3.0 5 votes vote down vote up
public static Image addOverHang(int x, int y, String name, String type, Group layer) {
    TextureAtlas.AtlasRegion region = Config.findRegions("tile/" + name + "-overhang-" + type).random();
    if (region == null) {
        region = Config.findRegions("tile/" + name + "-overhang").random();
        if (region == null)
            return null;
    }
    Image image = new Image(region);
    layer.addActor(image);
    image.setPosition(x * CELL_SIZE, (y + 1) * CELL_SIZE - image.getHeight());
    return image;
}
 
Example #23
Source File: Assets.java    From ud406 with MIT License 5 votes vote down vote up
public void init(AssetManager assetManager) {
    this.assetManager = assetManager;
    assetManager.setErrorListener(this);
    assetManager.load(Constants.TEXTURE_ATLAS, TextureAtlas.class);
    assetManager.finishLoading();

    TextureAtlas atlas = assetManager.get(Constants.TEXTURE_ATLAS);
    gigaGalAssets = new GigaGalAssets(atlas);
    platformAssets = new PlatformAssets(atlas);
    bulletAssets = new BulletAssets(atlas);
    enemyAssets = new EnemyAssets(atlas);
    explosionAssets = new ExplosionAssets(atlas);
    powerupAssets = new PowerupAssets(atlas);
    exitPortalAssets = new ExitPortalAssets(atlas);
}
 
Example #24
Source File: Assets.java    From ud406 with MIT License 5 votes vote down vote up
public void init(AssetManager assetManager) {
    this.assetManager = assetManager;
    assetManager.setErrorListener(this);
    assetManager.load(Constants.TEXTURE_ATLAS, TextureAtlas.class);
    assetManager.finishLoading();

    TextureAtlas atlas = assetManager.get(Constants.TEXTURE_ATLAS);
    gigaGalAssets = new GigaGalAssets(atlas);
    platformAssets = new PlatformAssets(atlas);
}
 
Example #25
Source File: ViewController.java    From dice-heroes with GNU General Public License v3.0 5 votes vote down vote up
public static Tile addBottomRightCorner(int x, int y, String name, Group layer) {
    TextureAtlas.AtlasRegion region = Config.findRegions("tile/" + name + "-corner-bottom-right").random();
    if (region == null)
        return null;
    Tile image = new Tile(region);
    layer.addActor(image);
    image.setPosition(x * CELL_SIZE, (y + 1) * CELL_SIZE - image.getHeight());
    return image;
}
 
Example #26
Source File: Assets.java    From ud406 with MIT License 5 votes vote down vote up
public ExplosionAssets(TextureAtlas atlas) {

            Array<AtlasRegion> explosionRegions = new Array<AtlasRegion>();
            explosionRegions.add(atlas.findRegion(Constants.EXPLOSION_LARGE));
            explosionRegions.add(atlas.findRegion(Constants.EXPLOSION_MEDIUM));
            explosionRegions.add(atlas.findRegion(Constants.EXPLOSION_SMALL));

            explosion = new Animation(Constants.EXPLOSION_DURATION / explosionRegions.size,
                    explosionRegions, PlayMode.NORMAL);
        }
 
Example #27
Source File: ViewController.java    From dice-heroes with GNU General Public License v3.0 5 votes vote down vote up
public static Tile addTopLeftCorner(int x, int y, String name, Group layer) {
    TextureAtlas.AtlasRegion region = Config.findRegions("tile/" + name + "-corner-top-left").random();
    if (region == null)
        return null;
    Tile image = new Tile(region);
    layer.addActor(image);
    image.setPosition((x + 1) * CELL_SIZE - image.getWidth(), y * CELL_SIZE);
    return image;
}
 
Example #28
Source File: Assets.java    From ud406 with MIT License 5 votes vote down vote up
public void init(AssetManager assetManager) {
    this.assetManager = assetManager;
    assetManager.setErrorListener(this);
    assetManager.load(Constants.TEXTURE_ATLAS, TextureAtlas.class);
    assetManager.finishLoading();

    TextureAtlas atlas = assetManager.get(Constants.TEXTURE_ATLAS);
    gigaGalAssets = new GigaGalAssets(atlas);
    platformAssets = new PlatformAssets(atlas);
    bulletAssets = new BulletAssets(atlas);
    enemyAssets = new EnemyAssets(atlas);
    explosionAssets = new ExplosionAssets(atlas);
    powerupAssets = new PowerupAssets(atlas);
}
 
Example #29
Source File: Config.java    From dice-heroes with GNU General Public License v3.0 5 votes vote down vote up
public static Array<TextureAtlas.AtlasRegion> findRegions(String regionName) {
    Array<TextureAtlas.AtlasRegion> result = foundRegions.get(regionName);
    if (result == null) {
        result = skin.getAtlas().findRegions(regionName);
        foundRegions.put(regionName, result);
    }
    return result;
}
 
Example #30
Source File: ViewController.java    From dice-heroes with GNU General Public License v3.0 5 votes vote down vote up
public static Image addBottomOutline(int x, int y, String name, Group layer) {
    TextureAtlas.AtlasRegion region = Config.findRegions("tile/" + name + "-outline").random();
    if (region == null)
        return null;
    Image image = new Image(region);
    image.setRotation(-90);
    layer.addActor(image);
    image.setPosition(x * CELL_SIZE, y * CELL_SIZE + image.getWidth());
    return image;
}