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


Java TextureAtlas.findRegion方法代码示例

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


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

示例1: initEntities

import com.badlogic.gdx.graphics.g2d.TextureAtlas; //导入方法依赖的package包/类
private void initEntities(TextureAtlas textureAtlas) {
    final float mobWidth = Polymorph.WORLD_WIDTH/4;
    player = new Player(new Vector2(Polymorph.WORLD_WIDTH/2 - mobWidth/2, Polymorph.WORLD_HEIGHT/3-mobWidth),
                        new Dimension(mobWidth, mobWidth));

    slots = new Array<Slot>();
    slotPool = new Pool<Slot>() {
        @Override
        protected Slot newObject() {
            return new Slot(new Vector2(SLOT_SPAWN_POINT),
                            new Vector2(slotVelocity),
                            new Dimension(mobWidth, mobWidth));
        }
    };

    Dimension mapSize = new Dimension(Polymorph.WORLD_WIDTH, (int)(Polymorph.WORLD_HEIGHT*1.1f));
    TextureRegion mapTexture = textureAtlas.findRegion("background");
    Map mapFront = new Map(new Vector2(0, 0), mapVelocity, mapSize, mapTexture);
    Map mapBack = new Map(new Vector2(0, -mapSize.height + 5), mapVelocity, mapSize, mapTexture);
    maps = new Map[]{mapFront, mapBack};
}
 
开发者ID:DurianHLN,项目名称:Polymorph,代码行数:22,代码来源:PolyGame.java

示例2: DeathScreen

import com.badlogic.gdx.graphics.g2d.TextureAtlas; //导入方法依赖的package包/类
public DeathScreen(Polymorph polymorph,int playerscore) {
    AssetManager assetManager = polymorph.getAssetManager();
    TextureAtlas textureAtlas = assetManager.get(Polymorph.MASTER_PATH, TextureAtlas.class);
    this.polymorph = polymorph;
    score=playerscore;

    DeathScreenMusic = assetManager.get(Polymorph.MAIN_MENU_MUSIC_PATH);
    DeathScreenMusic.setLooping(true);

    background = textureAtlas.findRegion("mainmenu"); //TODO make a unique background for the death screen
    screenSize = new Dimension(Gdx.graphics.getWidth(), Gdx.graphics.getHeight());

    camera = new OrthographicCamera();
    camera.setToOrtho(false, screenSize.width, screenSize.height); //change this
    batch=new SpriteBatch();
    batch.setProjectionMatrix(camera.combined);

    stage = new Stage();
    stage.clear();
    font = new BitmapFont(false);

    textureAtlas = assetManager.get(Polymorph.MASTER_PATH, TextureAtlas.class);
    initButtons(score,textureAtlas);
    Gdx.input.setInputProcessor(stage);

}
 
开发者ID:DurianHLN,项目名称:Polymorph,代码行数:27,代码来源:DeathScreen.java

示例3: onInit

import com.badlogic.gdx.graphics.g2d.TextureAtlas; //导入方法依赖的package包/类
/**
 * Inititalisiert den NPC.
 * Lädt alle Grafiken und Animationen.
 */
@Override
public void onInit()
{
    super.onInit();

    stoneAtlas = new TextureAtlas(Gdx.files.internal("data/graphics/packed/stone.atlas"));
    bigStone = stoneAtlas.findRegion("stone_big");

    if (rawObject instanceof RectangleMapObject)
    {
        RectangleMapObject rectObject = (RectangleMapObject) rawObject;
        Rectangle rect = rectObject.getRectangle();

        position = new Vector2(rect.getX() + rect.getWidth() / 2f, rect.getY());
        startPosition = new Vector2(rect.getX(), rect.getY());
        rectShape = Physics.createRectangle(rect.getWidth(), rect.getHeight(), new Vector2(rect.getWidth() / 2f, rect.getHeight() / 2f));

        if (activate)
            body = createEntityBody(startPosition, rectShape, BodyDef.BodyType.KinematicBody);

    } else {
        Gdx.app.log("WARNING", "Stone Barrier " + objectId + " must have an RectangleMapObject!");
        worldObjectManager.removeObject(this);
    }
}
 
开发者ID:Entwicklerpages,项目名称:school-game,代码行数:30,代码来源:StoneBarrier.java

示例4: preLoad

import com.badlogic.gdx.graphics.g2d.TextureAtlas; //导入方法依赖的package包/类
public void preLoad()
{
	input = new InputManager(se);
	Controllers.addListener(input);
	
	atlas = new TextureAtlas("main.atlas");
	titleScreenAtlas = new TextureAtlas("titlescreen.atlas");
	menuControlsAtlas = new TextureAtlas("menu.atlas");
	menuFont = new BitmapFont(Gdx.files.internal("data/cgcfont.fnt"), atlas.findRegion("cgcfont"), false);
	titleFont = new BitmapFont(Gdx.files.internal("data/cgctitlefont.fnt"), atlas.findRegion("cgctitlefont"), false);
	sBatch = new SpriteBatch(1625);
	shapes = new ShapeRenderer();
	tManager = new TweenManager();

	FileHandle baseFileHandle = Gdx.files.internal("i18n/CGCLang");
	I18NBundle myBundle = I18NBundle.createBundle(baseFileHandle, locale);

	lang = myBundle;
	ChaseApp.alert("lang loaded");
}
 
开发者ID:ChainGangChase,项目名称:cgc-game,代码行数:21,代码来源:ChaseApp.java

示例5: createAnimation

import com.badlogic.gdx.graphics.g2d.TextureAtlas; //导入方法依赖的package包/类
public static Animation createAnimation(TextureAtlas atlas,
        String regionName, float frameDuration, Animation.PlayMode mode) {
    ArrayList<TextureRegion> frames = new ArrayList<>();

    int idx = 0;
    TextureAtlas.AtlasRegion region;

    while ((region = atlas.findRegion(regionName, idx)) != null) {
        frames.add(region);
        idx++;
    }

    TextureRegion[] regions = new TextureRegion[idx];
    Animation anim = new Animation(frameDuration, frames.toArray(regions));
    anim.setPlayMode(mode);        
    return anim;
}
 
开发者ID:jh62,项目名称:Battle-City-Multiplayer,代码行数:18,代码来源:Assets.java

示例6: createStyle

import com.badlogic.gdx.graphics.g2d.TextureAtlas; //导入方法依赖的package包/类
static ImageButtonStyle createStyle(Skin skin, Item prototype/* slot*/) {
		//TextureAtlas icons = LibgdxUtils.assets.get("icons/icons.atlas", TextureAtlas.class);
//		TextureAtlas icons = new TextureAtlas(Gdx.files.internal("icons/icons.atlas"));
        TextureAtlas icons = GDefence.getInstance().assetLoader.get("icons/icons.atlas", TextureAtlas.class);
		TextureRegion image;
		if (/*slot.getPrototype()*/prototype != null) {
			image = icons.findRegion(prototype.getTextureRegion());
		} else {
			image = icons.findRegion("nothing");
		}
		ImageButtonStyle style = new ImageButtonStyle(skin.get(ButtonStyle.class));
		style.imageUp = new TextureRegionDrawable(image);
		style.imageDown = new TextureRegionDrawable(image);

		return style;
	}
 
开发者ID:mrDarkHouse,项目名称:GDefence,代码行数:17,代码来源:SlotActor.java

示例7: AssetGoldCoin

import com.badlogic.gdx.graphics.g2d.TextureAtlas; //导入方法依赖的package包/类
public AssetGoldCoin(TextureAtlas atlas) {
            goldCoin = atlas.findRegion("item_gold_coin");
            // Animation: Gold Coin
//            Array<TextureAtlas.AtlasRegion> regions = atlas.findRegions("anim_gold_coin");
//            TextureAtlas.AtlasRegion region = regions.first();
//            for (int i = 0; i < 10; i++)
//                regions.insert(0, region);
//            animGoldCoin = new Animation(1.0f / 20.0f, regions,
//                    Animation.LOOP_PINGPONG);
        }
 
开发者ID:davyjoneswang,项目名称:libgdx-learnlib,代码行数:11,代码来源:Assets.java

示例8: AssetLevelDecoration

import com.badlogic.gdx.graphics.g2d.TextureAtlas; //导入方法依赖的package包/类
public AssetLevelDecoration(TextureAtlas atlas) {
    cloud01 = atlas.findRegion("cloud01");
    cloud02 = atlas.findRegion("cloud02");
    cloud03 = atlas.findRegion("cloud03");
    mountainLeft = atlas.findRegion("mountain_left");
    mountainRight = atlas.findRegion("mountain_right");
    waterOverlay = atlas.findRegion("water_overlay");
    goal = atlas.findRegion("goal");
    carrot = atlas.findRegion("carrot");
}
 
开发者ID:davyjoneswang,项目名称:libgdx-learnlib,代码行数:11,代码来源:Assets.java

示例9: initAssets

import com.badlogic.gdx.graphics.g2d.TextureAtlas; //导入方法依赖的package包/类
private void initAssets() {
    AssetManager assetManager = polymorph.getAssetManager();
    TextureAtlas textureAtlas = assetManager.get(Polymorph.MASTER_PATH, TextureAtlas.class);

    splash = textureAtlas.findRegion("splashscreen");

    for (Shape shape : Shape.values()) {
        shape.setTexture(textureAtlas.findRegion(shape.name));
    }
    for (ShapeColor shapeColor : ShapeColor.values()) {
        shapeColor.setTexture(textureAtlas.findRegion("capsule"));
    }
}
 
开发者ID:DurianHLN,项目名称:Polymorph,代码行数:14,代码来源:Splash.java

示例10: SettingsScreen

import com.badlogic.gdx.graphics.g2d.TextureAtlas; //导入方法依赖的package包/类
public SettingsScreen(Polymorph polymorph) {
    AssetManager assetManager = polymorph.getAssetManager();
    TextureAtlas textureAtlas = assetManager.get(Polymorph.MASTER_PATH, TextureAtlas.class);

    this.polymorph = polymorph;

    mainMenuMusic = assetManager.get(Polymorph.MAIN_MENU_MUSIC_PATH, Music.class);
    background = textureAtlas.findRegion("settingsscreen");

    stage = new Stage(new StretchViewport(Polymorph.WORLD_WIDTH, Polymorph.WORLD_HEIGHT));
    stage.clear();
    initButtons(textureAtlas);
    Gdx.input.setInputProcessor(stage);
}
 
开发者ID:DurianHLN,项目名称:Polymorph,代码行数:15,代码来源:SettingsScreen.java

示例11: initAssets

import com.badlogic.gdx.graphics.g2d.TextureAtlas; //导入方法依赖的package包/类
private void initAssets() {
    AssetManager assetManager = polymorph.getAssetManager();
    TextureAtlas textureAtlas = assetManager.get(Polymorph.MASTER_PATH);

    mainMenuMusic = assetManager.get(Polymorph.MAIN_MENU_MUSIC_PATH);
    mainMenuMusic.setLooping(true);

    background = textureAtlas.findRegion("settingsscreen");
}
 
开发者ID:DurianHLN,项目名称:Polymorph,代码行数:10,代码来源:MainMenu.java

示例12: createHealthBar

import com.badlogic.gdx.graphics.g2d.TextureAtlas; //导入方法依赖的package包/类
private HealthBar createHealthBar(TextureAtlas textureAtlas) {
    Image barImage = new Image(textureAtlas.findRegion("hpbar-empty"));
    barImage.setBounds(Polymorph.WORLD_WIDTH/35, Polymorph.WORLD_HEIGHT/5.3f,
            Polymorph.WORLD_WIDTH/6, 3*Polymorph.WORLD_HEIGHT/4);
    Image healthImage = new Image(textureAtlas.findRegion("hpbar-full"));

    return new HealthBar(polyGame.getPlayer(), barImage, healthImage);
}
 
开发者ID:DurianHLN,项目名称:Polymorph,代码行数:9,代码来源:GameScreen.java

示例13: onInit

import com.badlogic.gdx.graphics.g2d.TextureAtlas; //导入方法依赖的package包/类
@Override
public void onInit()
{
    crystalAtlas = new TextureAtlas(Gdx.files.internal("data/graphics/packed/crystal.atlas"));
    crystal = crystalAtlas.findRegion("crystal");

    if (rawObject instanceof EllipseMapObject)
    {
        EllipseMapObject ellipseMapObject = (EllipseMapObject) rawObject;
        position = new Vector2(ellipseMapObject.getEllipse().x + ellipseMapObject.getEllipse().width / 2f, ellipseMapObject.getEllipse().y + ellipseMapObject.getEllipse().height / 2f);
    } else {
        Gdx.app.log("WARNING", "Crystal " + objectId + " must be an EllipseMapObject.");
        worldObjectManager.removeObject(this);
    }
}
 
开发者ID:Entwicklerpages,项目名称:school-game,代码行数:16,代码来源:Crystal.java

示例14: onInit

import com.badlogic.gdx.graphics.g2d.TextureAtlas; //导入方法依赖的package包/类
/**
 * Inititalisiert den NPC.
 * Lädt alle Grafiken und Animationen.
 */
@Override
public void onInit()
{
    super.onInit();

    npcAtlas = new TextureAtlas(Gdx.files.internal("data/graphics/packed/" + baseName + ".atlas"));
    npcFront = npcAtlas.findRegion(baseName + "_front");
    npcSide = npcAtlas.findRegion(baseName + "_side");
    npcBack = npcAtlas.findRegion(baseName + "_back");

    npcFrontWalk = new Animation<TextureRegion>(1/5f, npcAtlas.findRegions(baseName + "_front_walk"), Animation.PlayMode.LOOP);
    npcSideWalk = new Animation<TextureRegion>(1/5f, npcAtlas.findRegions(baseName + "_side_walk"), Animation.PlayMode.LOOP);
    npcBackWalk = new Animation<TextureRegion>(1/5f, npcAtlas.findRegions(baseName + "_back_walk"), Animation.PlayMode.LOOP);
}
 
开发者ID:Entwicklerpages,项目名称:school-game,代码行数:19,代码来源:BaseNPC.java

示例15: onInit

import com.badlogic.gdx.graphics.g2d.TextureAtlas; //导入方法依赖的package包/类
@Override
public void onInit()
{
    wolfAtlas = new TextureAtlas(Gdx.files.internal("data/graphics/packed/wolf.atlas"));
    wolf = wolfAtlas.findRegion("wolf_side", 4);

    if (rawObject instanceof EllipseMapObject)
    {
        EllipseMapObject ellipseMapObject = (EllipseMapObject) rawObject;
        position = new Vector2(ellipseMapObject.getEllipse().x + ellipseMapObject.getEllipse().width / 2f, ellipseMapObject.getEllipse().y + ellipseMapObject.getEllipse().height / 2f);
    } else {
        Gdx.app.log("WARNING", "EndingWolf " + objectId + " must be an EllipseMapObject.");
        worldObjectManager.removeObject(this);
    }
}
 
开发者ID:Entwicklerpages,项目名称:school-game,代码行数:16,代码来源:EndingWolf.java


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