本文整理汇总了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};
}
示例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);
}
示例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);
}
}
示例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");
}
示例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;
}
示例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;
}
示例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);
}
示例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");
}
示例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"));
}
}
示例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);
}
示例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");
}
示例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);
}
示例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);
}
}
示例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);
}
示例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);
}
}