use of com.esotericsoftware.spine.SkeletonData in project bladecoder-adventure-engine by bladecoder.
the class SpineRenderer method retrieveSource.
private void retrieveSource(String source, String atlas) {
EngineLogger.debug("Retrieving: " + source);
SkeletonCacheEntry entry = (SkeletonCacheEntry) sourceCache.get(source);
if (entry == null || entry.refCounter < 1) {
loadSource(source, atlas);
EngineAssetManager.getInstance().finishLoading();
entry = (SkeletonCacheEntry) sourceCache.get(source);
}
if (entry.skeleton == null) {
SkeletonData skeletonData = EngineAssetManager.getInstance().get(getFileName(source), SkeletonData.class);
entry.skeleton = new Skeleton(skeletonData);
// Defines
AnimationStateData stateData = new AnimationStateData(skeletonData);
// mixing
// between
// animations.
stateData.setDefaultMix(0f);
entry.animation = new AnimationState(stateData);
entry.animation.addListener(animationListener);
}
}
use of com.esotericsoftware.spine.SkeletonData in project bladecoder-adventure-engine by bladecoder.
the class SpineRenderer method setSkin.
public void setSkin(String skin) {
// set the skin if the current source is loaded
if (currentSource != null && currentSource.refCounter > 0) {
SkeletonCacheEntry sce = (SkeletonCacheEntry) currentSource;
EngineLogger.debug("Setting Spine skin: " + skin);
if (skin != null) {
SkeletonData skeletonData = sce.skeleton.getData();
if (skin.indexOf(',') == -1 || skeletonData.findSkin(skin) != null) {
sce.skeleton.setSkin(skin);
} else {
// we can combine several skins separated by ','
String[] skins = skin.split(",");
Skin combinedSkin = new Skin(skin);
for (String sk : skins) {
// Get the source skins.
Skin singleSkin = skeletonData.findSkin(sk.trim());
combinedSkin.addSkin(singleSkin);
}
// Set and apply the Skin to the skeleton.
sce.skeleton.setSkin(combinedSkin);
}
} else {
sce.skeleton.setSkin((Skin) null);
}
// sce.skeleton.setSlotsToSetupPose();
}
this.skin = skin;
}
use of com.esotericsoftware.spine.SkeletonData in project HyperLap2D by rednblackgames.
the class ResourcesManager method getSpineDrawable.
public SpineDrawable getSpineDrawable(String name) {
if (spineDrawableCache.get(name) == null) {
SpineDataObject spineDataObject = (SpineDataObject) tiledPlugin.getAPI().getSceneLoader().getRm().getExternalItemType(SpineItemType.SPINE_TYPE, name);
SkeletonData skeletonData = spineDataObject.skeletonData;
Skeleton skeleton = new Skeleton(skeletonData);
spineDrawableCache.put(name, new SpineDrawable(skeleton, skeletonRenderer));
}
return spineDrawableCache.get(name);
}
use of com.esotericsoftware.spine.SkeletonData in project HyperLap2D by rednblackgames.
the class SpineDrawStrategy method updateTile.
@Override
public void updateTile(int entity) {
if (!checkValidTile(entity))
return;
SpineComponent spineComponent = ComponentRetriever.get(entity, SpineComponent.class, tiledPlugin.getAPI().getEngine());
if (!spineComponent.animationName.equals(tiledPlugin.getSelectedTileName())) {
replaceSpineCommandBuilder.begin(entity);
String animName = tiledPlugin.getSelectedTileName();
replaceSpineCommandBuilder.setAnimationName(animName);
SpineDataObject spineDataObject = (SpineDataObject) tiledPlugin.getAPI().getSceneLoader().getRm().getExternalItemType(SpineItemType.SPINE_TYPE, animName);
replaceSpineCommandBuilder.setSkeletonJson(spineDataObject.skeletonJson);
SkeletonData skeletonData = spineDataObject.skeletonData;
replaceSpineCommandBuilder.setSkeleton(new Skeleton(skeletonData));
replaceSpineCommandBuilder.execute(tiledPlugin.facade);
}
}
Aggregations