Example usage for com.badlogic.gdx.assets.loaders.resolvers ClasspathFileHandleResolver ClasspathFileHandleResolver

List of usage examples for com.badlogic.gdx.assets.loaders.resolvers ClasspathFileHandleResolver ClasspathFileHandleResolver

Introduction

In this page you can find the example usage for com.badlogic.gdx.assets.loaders.resolvers ClasspathFileHandleResolver ClasspathFileHandleResolver.

Prototype

ClasspathFileHandleResolver

Source Link

Usage

From source file:de.longri.cachebox3.gui.stages.Splash.java

License:Open Source License

private void InitialView() {

    // create SVG image from Cachbox Logo
    try {/*ww  w . j  a v a 2 s .  c om*/
        InputStream stream = Gdx.files.internal("cb_logo.svg").read();
        float targetWidth = Gdx.graphics.getWidth() * 0.8f;
        Bitmap svgBitmap = PlatformConnector.getSvg("", stream, PlatformConnector.SvgScaleType.SCALED_TO_WIDTH,
                targetWidth);
        CB_Logo = new Image(new Texture(Utils.getPixmapFromBitmap(svgBitmap)));
        CB_Logo.setPosition((Gdx.graphics.getWidth() - svgBitmap.getWidth()) / 2, svgBitmap.getHeight() * 2);
        this.addActor(CB_Logo);
    } catch (Exception e) {
        e.printStackTrace();
    }

    ProgressBar.ProgressBarStyle style = new ProgressBar.ProgressBarStyle();
    int patch = 12;

    style.background = Utils.get9PatchFromSvg(Gdx.files.internal("progress_back.svg").read(), patch, patch,
            patch, patch);
    style.knob = Utils.get9PatchFromSvg(Gdx.files.internal("progress_foreground.svg").read(), patch, patch,
            patch, patch);
    style.knobBefore = Utils.get9PatchFromSvg(Gdx.files.internal("progress_foreground.svg").read(), patch,
            patch, patch, patch);
    style.background.setLeftWidth(0);
    style.background.setRightWidth(0);
    style.background.setTopHeight(0);
    style.background.setBottomHeight(0);

    style.knob.setLeftWidth(0);
    style.knob.setRightWidth(0);
    style.knob.setTopHeight(0);
    style.knob.setBottomHeight(0);

    style.knobBefore.setLeftWidth(0);
    style.knobBefore.setRightWidth(0);
    style.knobBefore.setTopHeight(0);
    style.knobBefore.setBottomHeight(0);

    progress = new VisProgressBar(0f, 100f, 1f, false, style);
    float margin = 40 * (CanvasAdapter.dpi / 240);
    float progressWidth = Gdx.graphics.getWidth() - (margin * 2);

    progress.setBounds(margin, margin, progressWidth, margin);
    this.addActor(progress);

    progress.setValue(0);

    // Init loader tasks
    initTaskList.add(new InitialWorkPathTask("InitialWorkPAth", 5));
    initTaskList.add(new SkinLoaderTask("Load UI", 30));
    initTaskList.add(new TranslationLoaderTask("Load Translations", 10));
    initTaskList.add(new GdxInitialTask("Initial GDX", 2));
    initTaskList.add(new InitialLocationListenerTask("Initial Loacation Reciver", 1));
    initTaskList.add(new LoadDbTask("Load Database", 10));

    // Use classpath for Desktop or assets for iOS and Android
    assets = (CanvasAdapter.platform.isDesktop()) ? new AssetManager(new ClasspathFileHandleResolver())
            : new AssetManager();

    assets.load("skins/day/3d_model/Pfeil.g3db", Model.class);
    assets.load("skins/day/3d_model/compass.g3db", Model.class);
    assets.load("skins/day/3d_model/compass_gray.g3db", Model.class);
    assets.load("skins/day/3d_model/compass_yellow.g3db", Model.class);
    loading = true;

    Gdx.graphics.requestRendering();
}