本文整理匯總了Java中com.badlogic.gdx.graphics.g2d.Animation.PlayMode方法的典型用法代碼示例。如果您正苦於以下問題:Java Animation.PlayMode方法的具體用法?Java Animation.PlayMode怎麽用?Java Animation.PlayMode使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類com.badlogic.gdx.graphics.g2d.Animation
的用法示例。
在下文中一共展示了Animation.PlayMode方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: createAnimation
import com.badlogic.gdx.graphics.g2d.Animation; //導入方法依賴的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;
}
示例2: AnimatedGraphicComponent
import com.badlogic.gdx.graphics.g2d.Animation; //導入方法依賴的package包/類
public AnimatedGraphicComponent(
TextureAtlas textureAtlas,
float animationTotalTime,
float width,
float height,
PhysicsComponent physicsComponent,
Animation.PlayMode playMode)
{
super(physicsComponent, width, height);
this.animationTime = Stopwatch.createStarted();
this.textureAtlas = textureAtlas;
this.animation = new Animation(
animationTotalTime / this.textureAtlas.getRegions().size,
this.textureAtlas.getRegions(),
playMode);
}
示例3: buildAnimation
import com.badlogic.gdx.graphics.g2d.Animation; //導入方法依賴的package包/類
private void buildAnimation(int TYPE, float frameDuration, String regionID, int[] indices, Animation.PlayMode playMode)
{
Array<TextureRegion> regionArray = new Array<TextureRegion>();
for(int i = 0; i < indices.length; i++)
{
regionArray.add(ChaseApp.menuControlsAtlas.findRegion(regionID, indices[i]));
}
controlAnimations[TYPE] = new Animation(frameDuration, regionArray);
controlAnimations[TYPE].setPlayMode(playMode);
}
示例4: AnimationSubView
import com.badlogic.gdx.graphics.g2d.Animation; //導入方法依賴的package包/類
public AnimationSubView(float frameDuration, Array<? extends TextureRegion> regions, Animation.PlayMode playType) {
this.animation = new Animation(frameDuration, regions, playType);
this.regions = regions;
if (regions.size > 0) {
TextureRegion region = regions.first();
actor.setSize(region.getRegionWidth(), region.getRegionHeight());
}
}