Search in sources :

Example 1 with SkeletonJson

use of com.esotericsoftware.spine.SkeletonJson in project HyperLap2D by rednblackgames.

the class ResourceManager method loadCurrentProjectSpineAnimations.

private void loadCurrentProjectSpineAnimations(String path) {
    spineAnimAtlases.clear();
    FileHandle sourceDir = new FileHandle(path);
    SpineDrawableLogic spineDrawableLogic = (SpineDrawableLogic) Sandbox.getInstance().sceneControl.sceneLoader.getExternalItemType(SpineItemType.SPINE_TYPE).getDrawable();
    for (FileHandle entry : sourceDir.list()) {
        if (entry.file().isDirectory()) {
            String animName = FilenameUtils.removeExtension(entry.file().getName());
            FileHandle animJsonFile = Gdx.files.internal(entry.file().getAbsolutePath() + File.separator + animName + ".json");
            SpineDataObject spineDataObject = new SpineDataObject();
            spineDataObject.skeletonJson = new SkeletonJson(new ResourceRetrieverAttachmentLoader(animName, this, spineDrawableLogic));
            spineDataObject.skeletonData = spineDataObject.skeletonJson.readSkeletonData(animJsonFile);
            spineAnimAtlases.put(animName, spineDataObject);
        }
    }
}
Also used : SpineDrawableLogic(games.rednblack.h2d.extension.spine.SpineDrawableLogic) ResourceRetrieverAttachmentLoader(games.rednblack.h2d.extension.spine.ResourceRetrieverAttachmentLoader) FileHandle(com.badlogic.gdx.files.FileHandle) SkeletonJson(com.esotericsoftware.spine.SkeletonJson) SpineDataObject(games.rednblack.h2d.extension.spine.SpineDataObject)

Example 2 with SkeletonJson

use of com.esotericsoftware.spine.SkeletonJson in project skin-composer by raeleus.

the class Main method create.

@Override
public void create() {
    appFolder = Gdx.files.external(".skincomposer/");
    skin = new FreeTypeSkin(Gdx.files.internal("skin-composer-ui/skin-composer-ui.json"));
    viewport = new ScreenViewport();
    // viewport.setUnitsPerPixel(.5f);
    var batch = new PolygonSpriteBatch(SPINE_MAX_VERTS);
    stage = new Stage(viewport, batch);
    Gdx.input.setInputProcessor(stage);
    shapeDrawer = new TinyVGShapeDrawer(stage.getBatch(), skin.getRegion("white"));
    graphDrawer = new GraphDrawer(shapeDrawer);
    tinyVGAssetLoader = new TinyVGAssetLoader();
    skeletonRenderer = new SkeletonRenderer();
    var skeletonJson = new SkeletonJson(Main.skin.getAtlas());
    floppySkeletonData = skeletonJson.readSkeletonData(Gdx.files.internal("spine/floppy.json"));
    floppyAnimationStateData = new AnimationStateData(floppySkeletonData);
    uiScaleSkeletonData = skeletonJson.readSkeletonData(Gdx.files.internal("spine/uiscale.json"));
    uiScaleAnimationStateData = new AnimationStateData(uiScaleSkeletonData);
    textraTypistLogoSkeletonData = skeletonJson.readSkeletonData(Gdx.files.internal("spine/TextraTypist Logo.json"));
    textraTypistLogoAnimationStateData = new AnimationStateData(textraTypistLogoSkeletonData);
    arrowSkeletonData = skeletonJson.readSkeletonData(Gdx.files.internal("spine/arrow-animation.json"));
    arrowAnimationStateData = new AnimationStateData(arrowSkeletonData);
    cursorNE = Utils.textureRegionToCursor(skin.getRegion("cursor_resize_ne"), 16, 16);
    cursorNW = Utils.textureRegionToCursor(skin.getRegion("cursor_resize_nw"), 16, 16);
    cursorVertical = Utils.textureRegionToCursor(skin.getRegion("cursor_resize_vertical"), 16, 16);
    cursorHorizontal = Utils.textureRegionToCursor(skin.getRegion("cursor_resize_horizontal"), 16, 16);
    initDefaults();
    populate();
    resizeUiScale(projectData.getUiScale());
}
Also used : TinyVGAssetLoader(dev.lyze.gdxtinyvg.TinyVGAssetLoader) GraphDrawer(space.earlygrey.shapedrawer.GraphDrawer) TinyVGShapeDrawer(dev.lyze.gdxtinyvg.drawers.TinyVGShapeDrawer) Stage(com.badlogic.gdx.scenes.scene2d.Stage) SkeletonJson(com.esotericsoftware.spine.SkeletonJson) SkeletonRenderer(com.esotericsoftware.spine.SkeletonRenderer) ScreenViewport(com.badlogic.gdx.utils.viewport.ScreenViewport) AnimationStateData(com.esotericsoftware.spine.AnimationStateData) FreeTypeSkin(com.ray3k.stripe.FreeTypeSkin) PolygonSpriteBatch(com.badlogic.gdx.graphics.g2d.PolygonSpriteBatch)

Example 3 with SkeletonJson

use of com.esotericsoftware.spine.SkeletonJson in project bladecoder-adventure-engine by bladecoder.

the class SkeletonDataLoader method loadAsync.

@Override
public void loadAsync(AssetManager manager, String fileName, FileHandle file, SkeletonDataLoaderParameter parameter) {
    skeletonData = null;
    TextureAtlas atlas = manager.get(parameter.atlasName, TextureAtlas.class);
    String extension = file.extension();
    if (extension.toLowerCase().equals("skel")) {
        SkeletonBinary skeletonBinary = new SkeletonBinary(atlas);
        skeletonBinary.setScale(parameter.scale);
        skeletonData = skeletonBinary.readSkeletonData(file);
    } else {
        SkeletonJson skeletonJson = new SkeletonJson(atlas);
        skeletonJson.setScale(parameter.scale);
        skeletonData = skeletonJson.readSkeletonData(file);
    }
}
Also used : TextureAtlas(com.badlogic.gdx.graphics.g2d.TextureAtlas) SkeletonJson(com.esotericsoftware.spine.SkeletonJson) SkeletonBinary(com.esotericsoftware.spine.SkeletonBinary)

Aggregations

SkeletonJson (com.esotericsoftware.spine.SkeletonJson)3 FileHandle (com.badlogic.gdx.files.FileHandle)1 PolygonSpriteBatch (com.badlogic.gdx.graphics.g2d.PolygonSpriteBatch)1 TextureAtlas (com.badlogic.gdx.graphics.g2d.TextureAtlas)1 Stage (com.badlogic.gdx.scenes.scene2d.Stage)1 ScreenViewport (com.badlogic.gdx.utils.viewport.ScreenViewport)1 AnimationStateData (com.esotericsoftware.spine.AnimationStateData)1 SkeletonBinary (com.esotericsoftware.spine.SkeletonBinary)1 SkeletonRenderer (com.esotericsoftware.spine.SkeletonRenderer)1 FreeTypeSkin (com.ray3k.stripe.FreeTypeSkin)1 TinyVGAssetLoader (dev.lyze.gdxtinyvg.TinyVGAssetLoader)1 TinyVGShapeDrawer (dev.lyze.gdxtinyvg.drawers.TinyVGShapeDrawer)1 ResourceRetrieverAttachmentLoader (games.rednblack.h2d.extension.spine.ResourceRetrieverAttachmentLoader)1 SpineDataObject (games.rednblack.h2d.extension.spine.SpineDataObject)1 SpineDrawableLogic (games.rednblack.h2d.extension.spine.SpineDrawableLogic)1 GraphDrawer (space.earlygrey.shapedrawer.GraphDrawer)1