本文整理汇总了Java中com.badlogic.gdx.graphics.g2d.TextureAtlas.AtlasRegion方法的典型用法代码示例。如果您正苦于以下问题:Java TextureAtlas.AtlasRegion方法的具体用法?Java TextureAtlas.AtlasRegion怎么用?Java TextureAtlas.AtlasRegion使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.badlogic.gdx.graphics.g2d.TextureAtlas
的用法示例。
在下文中一共展示了TextureAtlas.AtlasRegion方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createCachedAnimations
import com.badlogic.gdx.graphics.g2d.TextureAtlas; //导入方法依赖的package包/类
protected void createCachedAnimations(Map<String, Integer> map) {
int i = 0;
for (Map.Entry<String, Integer> entry : map.entrySet()) {
String animationName = entry.getKey();
int frameCounter = entry.getValue();
// calculate duration per frame
float durationPerFrame = this.sumDuration / frameCounter;
// get regions
Array<TextureAtlas.AtlasRegion> regions = this.atlas.findRegions(animationName);
// create animation
Animation<TextureRegion> anim = new Animation<>(durationPerFrame, regions, Animation.PlayMode.LOOP);
// add animation to map
this.animationMap.put(animationName, anim);
i++;
}
}
示例2: init
import com.badlogic.gdx.graphics.g2d.TextureAtlas; //导入方法依赖的package包/类
private void init() {
mSkillAtlas = MyGdxGame.assetManager.getTextureAtlas(Constant.FIREBALL_WIDGET);
//升龙斩动画初始化
mRJumpAtkRegions = new TextureAtlas.AtlasRegion[4];
for (int i = 0; i < mRJumpAtkRegions.length - 1; i++) {
mRJumpAtkRegions[i] = new TextureAtlas.AtlasRegion(mSkillAtlas.findRegion("jumpHit" + (i + 1)));
}
mRJumpAtkRegions[3] = new TextureAtlas.AtlasRegion(mSkillAtlas.findRegion("jumpHit3"));
mLJumpAtkRegions = new TextureAtlas.AtlasRegion[4];
for (int i = 0; i < mLJumpAtkRegions.length - 1; i++) {
mLJumpAtkRegions[i] = new TextureAtlas.AtlasRegion(mSkillAtlas.findRegion("jumpHit" + (i + 1)));
mLJumpAtkRegions[i].flip(true, false);
}
mLJumpAtkRegions[3] = mLJumpAtkRegions[2];
mRJumpAtkAni = new Animation(1 / 12f, mRJumpAtkRegions);
mLJumpAtkAni = new Animation(1 / 12f, mLJumpAtkRegions);
}
示例3: 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;
}
示例4: visualize
import com.badlogic.gdx.graphics.g2d.TextureAtlas; //导入方法依赖的package包/类
@Override public IFuture<Void> visualize(final AddEffect result) {
final Array<TextureAtlas.AtlasRegion> regions = Config.findRegions("animation/effect-" + result.ability.name);
if (regions.size == 0)
return Future.completed();
final WorldObjectView view = visualizer.viewController.getView(result.getTarget());
final AnimationSubView subView = new AnimationSubView(0.1f, regions, Animation.PlayMode.LOOP);
subView.getActor().setPosition(1, 2);
subView.priority = 1;
view.addSubView(subView);
visualizer.viewController.world.dispatcher.add(Creature.REMOVE_EFFECT, new EventListener<EffectEvent>() {
@Override public void handle(EventType<EffectEvent> type, EffectEvent event) {
if (event.effect != result.effectToApply || event.creature != result.creatureToAddEffect)
return;
visualizer.viewController.world.dispatcher.remove(Creature.REMOVE_EFFECT, this);
SoundManager.instance.playMusicAsSound("boss-protection-loss");
subView.getActor().addAction(Actions.alpha(0, DURATION));
subView.getActor().addAction(Actions.delay(DURATION, Actions.run(new Runnable() {
@Override public void run() {
view.removeSubView(subView);
}
})));
}
});
return Future.completed();
}
示例5: compose
import com.badlogic.gdx.graphics.g2d.TextureAtlas; //导入方法依赖的package包/类
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;
}
示例6: init
import com.badlogic.gdx.graphics.g2d.TextureAtlas; //导入方法依赖的package包/类
private void init() {
mAtlas = MyGdxGame.assetManager.getTextureAtlas(Constant.FIREBALL_WIDGET);
mLeftState = new TextureAtlas.AtlasRegion[2];
mLeftState[0] = new TextureAtlas.AtlasRegion(mAtlas.findRegion("leftfireball"));
mLeftState[1] = new TextureAtlas.AtlasRegion(mAtlas.findRegion("leftfireball"));
mRightState = new TextureAtlas.AtlasRegion[2];
mRightState[0] = new TextureAtlas.AtlasRegion(mAtlas.findRegion("rightfireball"));
mRightState[1] = new TextureAtlas.AtlasRegion(mAtlas.findRegion("rightfireball"));
}
示例7: addTopLeftCornerTransition
import com.badlogic.gdx.graphics.g2d.TextureAtlas; //导入方法依赖的package包/类
public static Image addTopLeftCornerTransition(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.setPosition(x * CELL_SIZE, y * CELL_SIZE);
return image;
}
示例8: addTopRightCornerTransition
import com.badlogic.gdx.graphics.g2d.TextureAtlas; //导入方法依赖的package包/类
public static Image addTopRightCornerTransition(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(-90);
image.setPosition(x * CELL_SIZE, (y + 1) * CELL_SIZE);
return image;
}
示例9: addBottomLeftCornerTransition
import com.badlogic.gdx.graphics.g2d.TextureAtlas; //导入方法依赖的package包/类
public static Image addBottomLeftCornerTransition(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(90);
image.setPosition((x + 1) * CELL_SIZE, (y) * CELL_SIZE);
return image;
}
示例10: addBottomRightCornerTransition
import com.badlogic.gdx.graphics.g2d.TextureAtlas; //导入方法依赖的package包/类
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;
}
示例11: addOverHang
import com.badlogic.gdx.graphics.g2d.TextureAtlas; //导入方法依赖的package包/类
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;
}
示例12: Orange
import com.badlogic.gdx.graphics.g2d.TextureAtlas; //导入方法依赖的package包/类
public Orange(final Application APP, TextureAtlas.AtlasRegion normalTexture, TextureAtlas.AtlasRegion hitTexture, Sprite redBar, Sprite greenBar)
{
super(APP, normalTexture, hitTexture, redBar, greenBar, 17, 10, 63, 60);
maxHealth = 15;
health = maxHealth;
explodable = false;
velocityMultiplier = 2f;
knockbackMultiplier = 1f;
}
示例13: addLeftOutline
import com.badlogic.gdx.graphics.g2d.TextureAtlas; //导入方法依赖的package包/类
public static Image addLeftOutline(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(180);
layer.addActor(image);
image.setPosition(x * CELL_SIZE + image.getWidth(), (y + 1) * CELL_SIZE);
return image;
}
示例14: addBottomOutline
import com.badlogic.gdx.graphics.g2d.TextureAtlas; //导入方法依赖的package包/类
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;
}
示例15: addTopOutline
import com.badlogic.gdx.graphics.g2d.TextureAtlas; //导入方法依赖的package包/类
public static Image addTopOutline(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 + 1) * CELL_SIZE, (y + 1) * CELL_SIZE - image.getWidth());
return image;
}