use of com.bladecoder.engine.model.ImageRenderer in project bladecoder-adventure-engine by bladecoder.
the class AnimationDrawer method setActor.
public void setActor(BaseActor a) {
if (renderer != null) {
renderer.dispose();
renderer = null;
}
if (a instanceof SpriteActor && ((SpriteActor) a).getRenderer() instanceof AnimationRenderer) {
ActorRenderer r = ((SpriteActor) a).getRenderer();
if (r instanceof Sprite3DRenderer) {
renderer = new Sprite3DRenderer();
((Sprite3DRenderer) renderer).setSpriteSize(new Vector2(r.getWidth(), r.getHeight()));
} else if (r instanceof SpineRenderer) {
renderer = new SpineRenderer();
((SpineRenderer) renderer).enableEvents(false);
((SpineRenderer) renderer).setSkin(((SpineRenderer) r).getSkin());
} else if (r instanceof ImageRenderer) {
renderer = new ImageRenderer();
} else if (r instanceof AtlasRenderer) {
renderer = new AtlasRenderer();
}
renderer.setOrgAlign(Align.bottom);
}
}
use of com.bladecoder.engine.model.ImageRenderer in project bladecoder-adventure-engine by bladecoder.
the class EditAnimationDialog method getSources.
private String[] getSources() {
String path = null;
ActorRenderer renderer = parent.getRenderer();
if (renderer instanceof AtlasRenderer) {
path = Ctx.project.getAssetPath() + Project.ATLASES_PATH + "/" + Ctx.project.getResDir();
ext = EngineAssetManager.ATLAS_EXT;
} else if (renderer instanceof Sprite3DRenderer) {
path = Ctx.project.getAssetPath() + Project.SPRITE3D_PATH;
ext = EngineAssetManager.MODEL3D_EXT;
} else if (renderer instanceof SpineRenderer) {
path = Ctx.project.getAssetPath() + Project.SPINE_PATH;
ext = EngineAssetManager.SPINE_EXT;
} else if (renderer instanceof ImageRenderer) {
path = Ctx.project.getAssetPath() + Project.IMAGE_PATH + "/" + Ctx.project.getResDir();
ext = "";
}
File f = new File(path);
String[] sources = f.list(new FilenameFilter() {
@Override
public boolean accept(File arg0, String arg1) {
if (arg1.endsWith(ext))
return true;
return false;
}
});
if (sources != null) {
Arrays.sort(sources);
for (int i = 0; i < sources.length; i++) sources[i] = sources[i].substring(0, sources[i].length() - ext.length());
} else {
sources = new String[0];
}
return sources;
}
use of com.bladecoder.engine.model.ImageRenderer in project bladecoder-adventure-engine by bladecoder.
the class EditAnimationDialog method setSource.
private void setSource() {
AnimationDesc anim = null;
ActorRenderer renderer = parent.getRenderer();
String sourceStr = source.getText();
if (renderer instanceof SpineRenderer) {
anim = new SpineAnimationDesc();
if (spineAtlasExists(sourceStr)) {
((SpineAnimationDesc) anim).atlas = null;
setVisible(atlas, false);
} else {
if (!atlas.isVisible()) {
setVisible(atlas, true);
}
((SpineAnimationDesc) anim).atlas = atlas.getText();
}
} else if (renderer instanceof AtlasRenderer) {
anim = new AtlasAnimationDesc();
} else {
anim = new AnimationDesc();
}
anim.source = sourceStr;
anim.count = Tween.INFINITY;
anim.preload = true;
anim.disposeWhenPlayed = false;
if (renderer instanceof SpineRenderer) {
spriteWidget.setSource(Project.SPINE_RENDERER_STRING, anim);
} else if (renderer instanceof AtlasRenderer) {
spriteWidget.setSource(Project.ATLAS_RENDERER_STRING, anim);
} else if (renderer instanceof ImageRenderer) {
spriteWidget.setSource(Project.IMAGE_RENDERER_STRING, anim);
} else if (renderer instanceof Sprite3DRenderer) {
spriteWidget.setSource(Project.S3D_RENDERER_STRING, anim);
}
}
Aggregations