Search in sources :

Example 1 with TinyVGAssetLoader

use of dev.lyze.gdxtinyvg.TinyVGAssetLoader in project gdx-TinyVG by lyze237.

the class BoundingBoxTests method setupTvg.

private void setupTvg(String file) {
    Gdx.app.postRunnable(() -> {
        tvg = new TinyVGAssetLoader().load(file);
        viewport = new FitViewport(tvg.getUnscaledWidth() * 2, tvg.getUnscaledHeight() * 2);
        resize(Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
    });
}
Also used : TinyVGAssetLoader(dev.lyze.gdxtinyvg.TinyVGAssetLoader) FitViewport(com.badlogic.gdx.utils.viewport.FitViewport)

Example 2 with TinyVGAssetLoader

use of dev.lyze.gdxtinyvg.TinyVGAssetLoader in project gdx-TinyVG by lyze237.

the class ScalingTest method setupTvg.

private void setupTvg(String file) {
    Gdx.app.postRunnable(() -> {
        tvg = new TinyVGAssetLoader().load(file);
        viewport = new FitViewport(tvg.getScaledWidth() * 5, tvg.getScaledHeight() * 5);
        tvg.centerOrigin();
        tvg.setOriginBasedPosition(viewport.getWorldWidth() / 2f, viewport.getWorldHeight() / 2f);
        resize(Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
    });
}
Also used : TinyVGAssetLoader(dev.lyze.gdxtinyvg.TinyVGAssetLoader) FitViewport(com.badlogic.gdx.utils.viewport.FitViewport)

Example 3 with TinyVGAssetLoader

use of dev.lyze.gdxtinyvg.TinyVGAssetLoader in project gdx-TinyVG by lyze237.

the class AssetManagerTest method SquareAssetManagerTest.

@Test
public void SquareAssetManagerTest() {
    var assetManager = new AssetManager();
    assetManager.setLoader(TinyVG.class, new TinyVGAssetLoader());
    assetManager.load("twoSquares.tvg", TinyVG.class);
    assetManager.finishLoading();
    var tvg = assetManager.get("twoSquares.tvg", TinyVG.class);
    Assertions.assertNotNull(tvg);
}
Also used : AssetManager(com.badlogic.gdx.assets.AssetManager) TinyVGAssetLoader(dev.lyze.gdxtinyvg.TinyVGAssetLoader) lombok.var(lombok.var) Test(org.junit.jupiter.api.Test) LibgdxHeadlessUnitTest(dev.lyze.gdxtinyvg.headless.LibgdxHeadlessUnitTest)

Example 4 with TinyVGAssetLoader

use of dev.lyze.gdxtinyvg.TinyVGAssetLoader 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 5 with TinyVGAssetLoader

use of dev.lyze.gdxtinyvg.TinyVGAssetLoader in project gdx-TinyVG by lyze237.

the class DepthTest method setupTvg.

private void setupTvg(String file) {
    Gdx.app.postRunnable(() -> {
        tvg = new TinyVGAssetLoader().load(file);
        viewport = new FitViewport(tvg.getScaledWidth() * 5, tvg.getScaledHeight() * 5);
        tvg.centerOrigin();
        tvg.setOriginBasedPosition(viewport.getWorldWidth() / 2f, viewport.getWorldHeight() / 2f);
        resize(Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
    });
}
Also used : TinyVGAssetLoader(dev.lyze.gdxtinyvg.TinyVGAssetLoader) FitViewport(com.badlogic.gdx.utils.viewport.FitViewport)

Aggregations

TinyVGAssetLoader (dev.lyze.gdxtinyvg.TinyVGAssetLoader)8 FitViewport (com.badlogic.gdx.utils.viewport.FitViewport)4 lombok.var (lombok.var)3 AssetManager (com.badlogic.gdx.assets.AssetManager)2 LibgdxHeadlessUnitTest (dev.lyze.gdxtinyvg.headless.LibgdxHeadlessUnitTest)2 Test (org.junit.jupiter.api.Test)2 Color (com.badlogic.gdx.graphics.Color)1 PolygonSpriteBatch (com.badlogic.gdx.graphics.g2d.PolygonSpriteBatch)1 Stage (com.badlogic.gdx.scenes.scene2d.Stage)1 Logger (com.badlogic.gdx.utils.Logger)1 ScreenViewport (com.badlogic.gdx.utils.viewport.ScreenViewport)1 AnimationStateData (com.esotericsoftware.spine.AnimationStateData)1 SkeletonJson (com.esotericsoftware.spine.SkeletonJson)1 SkeletonRenderer (com.esotericsoftware.spine.SkeletonRenderer)1 FreeTypeSkin (com.ray3k.stripe.FreeTypeSkin)1 TinyVGTextureAssetLoader (dev.lyze.gdxtinyvg.TinyVGTextureAssetLoader)1 TinyVGShapeDrawer (dev.lyze.gdxtinyvg.drawers.TinyVGShapeDrawer)1 GraphDrawer (space.earlygrey.shapedrawer.GraphDrawer)1