当前位置: 首页>>代码示例>>Java>>正文


Java TextureAtlas.getRegions方法代码示例

本文整理汇总了Java中com.badlogic.gdx.graphics.g2d.TextureAtlas.getRegions方法的典型用法代码示例。如果您正苦于以下问题:Java TextureAtlas.getRegions方法的具体用法?Java TextureAtlas.getRegions怎么用?Java TextureAtlas.getRegions使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.badlogic.gdx.graphics.g2d.TextureAtlas的用法示例。


在下文中一共展示了TextureAtlas.getRegions方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: addSpriteFrameWithTextureAtlas

import com.badlogic.gdx.graphics.g2d.TextureAtlas; //导入方法依赖的package包/类
/**
 * 读取gdx textureAtlas文件
 * @param filePath atlas 文件路径 也可以自定义
 * @param atlas
 */
public void addSpriteFrameWithTextureAtlas(String filePath, TextureAtlas atlas) {
	if(_atlases.containsKey(filePath)) {
		CCLog.debug(this.getClass(), "file loaded : " + filePath);
		return;
	}
	
	_atlases.put(filePath, atlas);
	
	Array<AtlasRegion> rs = atlas.getRegions();
	for(AtlasRegion r : rs) {
		TextureRegion ret = _spriteFrames.put(r.name, r);
		if(ret != null) {
			CCLog.debug(this.getClass(), "region name exists : " + r.name);
		}
	}
}
 
开发者ID:mingwuyun,项目名称:cocos2d-java,代码行数:22,代码来源:SpriteFrameCache.java

示例2: create

import com.badlogic.gdx.graphics.g2d.TextureAtlas; //导入方法依赖的package包/类
@Override
public void create () {
	entityAtlas = new TextureAtlas("sprites/entities.txt");
	tileAtlas = new TextureAtlas("sprites/tiles.txt");
	tileConnectionAtlas = new TextureAtlas("sprites/tileconnectmap.txt");
	iconAtlas = new TextureAtlas("sprites/icons.txt");
	batch = new SpriteBatch();
	font = new BitmapFont(); // uses libGDX's default Arial font
	
	for(AtlasRegion region: iconAtlas.getRegions())
		icons.put(region.name, region);
	
	game = this;
	
	this.setScreen(new MainMenuScreen());
}
 
开发者ID:chrisj42,项目名称:miniventure,代码行数:17,代码来源:GameCore.java

示例3: removeSpriteFramesFromTextureAtlas

import com.badlogic.gdx.graphics.g2d.TextureAtlas; //导入方法依赖的package包/类
public void removeSpriteFramesFromTextureAtlas(String filePath) {
	TextureAtlas atlas = _atlases.get(filePath);
	
	if(atlas == null) {
		CCLog.debug(this.getClass(), "remove atlas not found : " + filePath);
		return;
	}
	
	Array<AtlasRegion> rs = atlas.getRegions();
	for(AtlasRegion r : rs) {
		_spriteFrames.remove(r.name);
	}
}
 
开发者ID:mingwuyun,项目名称:cocos2d-java,代码行数:14,代码来源:SpriteFrameCache.java

示例4: getTileChecks

import com.badlogic.gdx.graphics.g2d.TextureAtlas; //导入方法依赖的package包/类
private static TileTouchCheck[] getTileChecks(TextureAtlas atlas) {
	Texture texture = atlas.getTextures().first();
	if (!texture.getTextureData().isPrepared())
		texture.getTextureData().prepare();
	Pixmap pixelMap = texture.getTextureData().consumePixmap();
	
	Array<AtlasRegion> tileMaps = atlas.getRegions(); // hopefully, they are in order.
	TileTouchCheck[] checks = new TileTouchCheck[tileMaps.size];
	for(int i = 0; i < checks.length; i++) {
		checks[i] = new TileTouchCheck(pixelMap, tileMaps.get(i));
	}
	
	return checks;
}
 
开发者ID:chrisj42,项目名称:miniventure,代码行数:15,代码来源:TileTouchCheck.java

示例5: Explosion

import com.badlogic.gdx.graphics.g2d.TextureAtlas; //导入方法依赖的package包/类
public Explosion(TextureAtlas atlas, Sound sound)
{
    animation = new Animation(1 / ANIMATION_FPS, atlas.getRegions(), Animation.PlayMode.NORMAL);
    position = new Vector2();

    this.sound = sound;
    isBusy = false;
}
 
开发者ID:NahroTo,项目名称:Fruit-Destroyer,代码行数:9,代码来源:Explosion.java

示例6: generatePages

import com.badlogic.gdx.graphics.g2d.TextureAtlas; //导入方法依赖的package包/类
private void generatePages(TextureAtlas atlas) {
    Array<Texture> textures = new Array<>();

    // We could use simple atlas.getTextures(), but it returns them in random order...
    for (TextureRegion region : atlas.getRegions()) {
        if (!textures.contains(region.getTexture(), true)) {
            textures.add(region.getTexture());
        }
    }
    pages.clear();
    for (int i = 0; i < textures.size; i++) {
        Page page = new Page(this, textures.get(i), i);
        pages.add(page);
    }
}
 
开发者ID:crashinvaders,项目名称:gdx-texture-packer-gui,代码行数:16,代码来源:AtlasModel.java

示例7: loadImages

import com.badlogic.gdx.graphics.g2d.TextureAtlas; //导入方法依赖的package包/类
private void loadImages(TextureAtlas textureAtlas) {
    for (TextureAtlas.AtlasRegion textureRegion : textureAtlas.getRegions()) {
        Sprite sprite = textureAtlas.createSprite(textureRegion.name);
        sprites.put(textureRegion.name, sprite);
    }
}
 
开发者ID:CTrando,项目名称:pmd,代码行数:7,代码来源:PMD.java

示例8: AssetsGame

import com.badlogic.gdx.graphics.g2d.TextureAtlas; //导入方法依赖的package包/类
private AssetsGame() {
    this.ASSET_ATLAS = new AssetDescriptor(
            Presets.TEXTURE_ENTITIES + "sprites.pack", TextureAtlas.class);
    this.animations = new HashMap<>();
    this.textures = new HashMap<>();

    manager = new AssetManager();
    manager.load(ASSET_ATLAS);
    manager.load(Presets.TEXTURE_UI + DEFAULT_FONT, BitmapFont.class);
    manager.load(Presets.TEXTURE_UI + CHAT_FONT, BitmapFont.class);

    manager.finishLoading();

    ATLAS = (TextureAtlas) manager.get(ASSET_ATLAS);

    for (TextureRegion r : ATLAS.getRegions()) {

        if (textures.containsKey(r.toString()) || animations.containsKey(r.
                toString())) {
            continue;
        }

        int idx = 0;
        AtlasRegion region;
        ArrayList<TextureRegion> frames = new ArrayList<>();

        while ((region = ATLAS.findRegion(r.toString(), idx)) != null) {
            frames.add(region);
            idx++;
        }

        if (frames.size() > 1) {
            TextureRegion[] animFrames = new TextureRegion[idx];
            Animation anim = new Animation(.1f, frames.toArray(animFrames));
            animations.put(animFrames[0].toString(), anim);
        } else {
            TextureRegion rg = frames.get(0);
            textures.put(rg.toString(), new Sprite(rg));
        }
    }

    defaultFont = manager.get(Presets.TEXTURE_UI + DEFAULT_FONT);
    chatFont = manager.get(Presets.TEXTURE_UI + CHAT_FONT);

    SIDEBAR_WIDTH = textures.get("sidebar").getWidth();
    SIDEBAR_HEIGHT = textures.get("sidebar").getHeight();

    soundManager = new SFXS();
    soundManager.addSound("tankIdle", "idle.ogg");
    soundManager.addSound("tankMoving", "moving.ogg");
    soundManager.addSound("tankDead", "explosion.ogg");
    soundManager.addSound("bulletShoot", "shoot.ogg");
    soundManager.addSound("enemyHit", "enemy_hit.ogg");
    soundManager.addSound("wallHit", "wall_hit.ogg");
    soundManager.addSound("bulletDead", "bullet_dead.ogg");
    soundManager.addSound("eagleDead", "eagle_down.ogg");
    soundManager.addSound("powerup", "power_up.ogg");
    soundManager.addSound("powerShow", "powerup_show.ogg");
    soundManager.addSound("stageStart", "stage_start.ogg");
    soundManager.addSound("gameOver", "gameover.ogg");
    soundManager.addSound("pause", "pause.ogg");
    soundManager.addSound("unPause", "unpause.ogg");
    soundManager.addSound("playerLife", "life.ogg");

    postLoading();
}
 
开发者ID:jh62,项目名称:Battle-City-Multiplayer,代码行数:67,代码来源:AssetsGame.java


注:本文中的com.badlogic.gdx.graphics.g2d.TextureAtlas.getRegions方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。