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

The following examples show how to use com.badlogic.gdx.graphics.g2d.TextureAtlas. These examples are extracted from open source projects. 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 Project: jorbs-spire-mod   Source File: StaticMemoryInfo.java    License: 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 2
Source Project: talos   Source File: TalosAssetProvider.java    License: 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 3
Source Project: talos   Source File: TalosAssetProvider.java    License: 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 4
Source Project: StS-DefaultModBase   Source File: RarePower.java    License: 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 5
Source Project: StS-DefaultModBase   Source File: CommonPower.java    License: 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 6
Source Project: ud406   Source File: Assets.java    License: 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 7
Source Project: ud406   Source File: Assets.java    License: 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 8
Source Project: ud406   Source File: Assets.java    License: 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 Project: skin-composer   Source File: GraphicWidget.java    License: 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 10
Source Project: ud406   Source File: Assets.java    License: 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 11
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 Project: ud406   Source File: Assets.java    License: 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 13
Source Project: ud406   Source File: Assets.java    License: 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 14
Source Project: ud406   Source File: Assets.java    License: 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 Project: ud406   Source File: Assets.java    License: 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
@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 17
@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 18
Source Project: ud406   Source File: Assets.java    License: 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 Project: ud406   Source File: Assets.java    License: 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 20
Source Project: ud406   Source File: Assets.java    License: MIT License 5 votes vote down vote up
public ExitPortalAssets(TextureAtlas atlas) {
    final AtlasRegion exitPortal1 = atlas.findRegion(Constants.EXIT_PORTAL_SPRITE_1);
    final AtlasRegion exitPortal2 = atlas.findRegion(Constants.EXIT_PORTAL_SPRITE_2);
    final AtlasRegion exitPortal3 = atlas.findRegion(Constants.EXIT_PORTAL_SPRITE_3);
    final AtlasRegion exitPortal4 = atlas.findRegion(Constants.EXIT_PORTAL_SPRITE_4);
    final AtlasRegion exitPortal5 = atlas.findRegion(Constants.EXIT_PORTAL_SPRITE_5);
    final AtlasRegion exitPortal6 = atlas.findRegion(Constants.EXIT_PORTAL_SPRITE_6);

    Array<AtlasRegion> exitPortalFrames = new Array<AtlasRegion>();
    exitPortalFrames.addAll(exitPortal1, exitPortal2, exitPortal3, exitPortal4, exitPortal5, exitPortal6);

    exitPortal = new Animation(Constants.EXIT_PORTAL_FRAME_DURATION, exitPortalFrames);
}
 
Example 21
public LevelStartScreen(final NinjaRabbitGame game) {
	super(game);
	PlayerStatus playerStatus = game.getPlayerStatus();
	stage = new Stage(new ScreenViewport(), game.getBatch());

	Label.LabelStyle style = new Label.LabelStyle();
	style.fontColor = Color.WHITE;
	style.font = game.getAssetsManager().get(Assets.HUD_FONT);

	TextureAtlas hudAtlas = game.getAssetsManager().get(Assets.NINJA_RABBIT_ATLAS);

	Label collectiblesLabel = new Label(String.format(TWO_DIGITS, playerStatus.getCollectibles()), style);
	Label livesLabel = new Label(String.format(LIVES_FORMAT, playerStatus.getLives()), style);
	Label scoreLabel = new Label(String.format(EIGHT_DIGITS, playerStatus.getScore()), style);
	Label timeLabel = new Label(String.format(THREE_DIGITS, playerStatus.getTime()), style);

	Table status = new Table();
	status.add(new Image(hudAtlas.findRegion(SMALL_CARROT_REGION))).padRight(4.0f);
	status.add(collectiblesLabel).bottom();
	status.add(scoreLabel).expandX();
	status.add(new Image(hudAtlas.findRegion(TIME_REGION))).padRight(12.0f);
	status.add(timeLabel).row();
	status.setFillParent(true);
	status.top();
	status.pad(15.0f);
	stage.addActor(status);

	Table levelInfo = new Table();
	levelInfo.add(new Label(LEVEL_LABEL, style)).expandX().right().padRight(18.0f);
	levelInfo.add(new Label(String.format(LEVEL_FORMAT, playerStatus.getWorld(), playerStatus.getLevel()), style)).expandX()
			.left().padTop(18.0f).row();
	Image livesIcon = new Image(hudAtlas.findRegion(LIVES_REGION));
	levelInfo.add(livesIcon).expandX().right().spaceRight(25f);
	levelInfo.add(livesLabel).expandX().left().bottom();
	levelInfo.setFillParent(true);
	stage.addActor(levelInfo);

}
 
Example 22
Source Project: ud406   Source File: Assets.java    License: MIT License 5 votes vote down vote up
public void init() {
    this.assetManager = new AssetManager();
    assetManager.setErrorListener(this);
    assetManager.load(Constants.TEXTURE_ATLAS, TextureAtlas.class);
    assetManager.finishLoading();

    TextureAtlas atlas = assetManager.get(Constants.TEXTURE_ATLAS);
    gigaGalAssets = new GigaGalAssets(atlas);
}
 
Example 23
Source Project: ud406   Source File: Assets.java    License: 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 24
Source Project: ud406   Source File: Assets.java    License: 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 25
Source Project: ud406   Source File: Assets.java    License: 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 26
Source Project: talos   Source File: SkeletonAttachmentLoader.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public MeshAttachment newMeshAttachment (Skin skin, String name, String path) {
    TextureAtlas.AtlasRegion region = atlasRef.findRegion(path);
    if(region == null) {
        return super.newMeshAttachment(skin, name, stripPath(path));
    } else {
        return super.newMeshAttachment(skin, name, path);
    }
}
 
Example 27
Source Project: ud406   Source File: Assets.java    License: 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);
}
 
Example 28
Source Project: uracer-kotd   Source File: Art.java    License: Apache License 2.0 5 votes vote down vote up
public static void loadScreensData () {
	scrBackground = newTexture("data/base/titlescreen.png", true);

	// the skin will automatically search and load the same filename+".atlas" extension

	// skinAtlas = new TextureAtlas("data/ui/skin/skin.atlas");
	// if (ScaleUtils.PlayWidth < 1280) {
	// scrSkin = new Skin(Gdx.files.internal(Storage.UI + "skin/skin-small.json"), skinAtlas);
	// } else if (ScaleUtils.PlayWidth >= 1280) { // && ScaleUtils.PlayWidth < 1440) {
	// scrSkin = new Skin(Gdx.files.internal(Storage.UI + "skin/skin-big.json"), skinAtlas);
	// }
	// old
	// else if (ScaleUtils.PlayWidth >= 1440) {
	// scrSkin = new Skin(Gdx.files.internal(Storage.UI + "skin-big.json"), skinAtlas);
	// }

	// // holo
	// String skinName = "Holo-dark-ldpi";
	// String skinPath = Storage.UI + "holo/" + skinName;
	// skinAtlas = new TextureAtlas(Gdx.files.internal(skinPath + ".atlas"));
	// scrSkin = new Skin(Gdx.files.internal(skinPath + ".json"), skinAtlas);

	// kenney
	String skinPath = Storage.UI + "kenney/";
	skinAtlas = new TextureAtlas(Gdx.files.internal(skinPath + "pack.atlas"));
	scrSkin = new Skin(Gdx.files.internal(skinPath + "kenney.json"), skinAtlas);

	// brushed texture
	scrPanel = newTexture("data/base/panel.png", false);
}
 
Example 29
Source Project: ud406   Source File: Assets.java    License: 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);
    enemyAssets = new EnemyAssets(atlas);
}
 
Example 30
Source Project: ud406   Source File: Assets.java    License: 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);
}