@Override public void initialise() { FallbackFileHandleResolver fallbackFileHandleResolver = new FallbackFileHandleResolver( new ClasspathFileHandleResolver(), new InternalFileHandleResolver()); assetManager = new AssetManager(fallbackFileHandleResolver); assetManager.setLogger(new Logger("AssetManager", Application.LOG_ERROR)); assetManager.setLoader(UiTheme.class, new UiThemeLoader(fallbackFileHandleResolver)); assetManager.setLoader(TiledMap.class, new TiledMapLoader(fallbackFileHandleResolver)); addScreen(new LoadingScreen(assetManager)); addScreen(new UATSelectionScreen(assetManager)); addScreen(new BlendingUAT()); addScreen(new ClippingUAT()); addScreen(new GeometryUAT()); addScreen(new GraphicsUAT(assetManager)); addScreen(new TextureRegionUAT()); addScreen(new OrthogonalTiledMapNoCachingUAT(assetManager)); addScreen(new OrthogonalTiledMapWithCachingUAT(assetManager)); addScreen(new IsometricTiledMapUAT(assetManager)); addScreen(new HexagonalTiledMapUAT(assetManager)); addScreen(new ParticleEffectsUAT()); addScreen(new ControllerUAT()); addScreen(new ControllerMapping()); addScreen(new UiUAT(assetManager)); }
@Override public FileHandleResolver newResolver (FileType fileType) { switch (fileType) { case Absolute: return new AbsoluteFileHandleResolver(); case Classpath: return new ClasspathFileHandleResolver(); case External: return new ExternalFileHandleResolver(); case Internal: return new InternalFileHandleResolver(); case Local: return new LocalFileHandleResolver(); } return null; // Should never happen }
public UiEditor(String directory, String gameThemePath) { super(); this.directory = directory; this.gameThemePath = gameThemePath; FileHandleResolver fileHandleResolver = new FallbackFileHandleResolver(new ClasspathFileHandleResolver(), new InternalFileHandleResolver()); assetManager = new AssetManager(fileHandleResolver); assetManager.setLoader(UiTheme.class, new UiThemeLoader(fileHandleResolver)); assetManager.load(UiTheme.DEFAULT_THEME_FILENAME, UiTheme.class); assetManager.load(gameThemePath, UiTheme.class); uiContainer = new UiContainer(this, assetManager); }
private void InitialView() { // create SVG image from Cachbox Logo try { 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); if (svgBitmap != null) { CB.CB_Logo = new Image(new Texture(Utils.getPixmapFromBitmap(svgBitmap))); CB.CB_Logo.setPosition((Gdx.graphics.getWidth() - svgBitmap.getWidth()) / 2, svgBitmap.getHeight() * 2); this.addActor(CB.CB_Logo); } } catch (Exception e) { e.printStackTrace(); } ProgressBar.ProgressBarStyle style = new ProgressBar.ProgressBarStyle(); style.background = SvgSkinUtil.getSvgNinePatchDrawable(-1, -1, -1, -1 , 0, 0, -1, -1 , Utils.getTextureRegion(Gdx.files.internal("progress_back.svg").read())); style.knobBefore = SvgSkinUtil.getSvgNinePatchDrawable(-1, -1, -1, -1 , -1, -1, -1, -1 , Utils.getTextureRegion(Gdx.files.internal("progress_foreground.svg").read())); 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, ((SvgNinePatchDrawable) style.background).getPatch().getTotalHeight()); this.addActor(progress); progress.setValue(0); Label.LabelStyle labelStyle = new Label.LabelStyle(); String path = "skins/day/fonts/DroidSans.ttf"; labelStyle.fontColor = Color.BLACK; labelStyle.font = new SkinFont(path, Gdx.files.internal(path), 20, null); workLabel = new Label(" \n ", labelStyle); workLabel.setBounds(margin, margin + progress.getHeight() + margin, progressWidth, workLabel.getPrefHeight()); this.addActor(workLabel); // Init loader tasks initTaskList.add(new InitialWorkPathTask("InitialWorkPAth")); initTaskList.add(new SkinLoaderTask("Load UI")); initTaskList.add(new TranslationLoaderTask("Load Translations")); initTaskList.add(new GdxInitialTask("Initial GDX")); initTaskList.add(new InitialLocationListenerTask("Initial Loacation Reciver")); initTaskList.add(new LoadDbTask("Load Database")); // Use classpath for Desktop or assets for iOS and Android assets = (CanvasAdapter.platform.isDesktop()) ? new AssetManager(new ClasspathFileHandleResolver()) : new AssetManager(); Gdx.graphics.requestRendering(); }
public TestAssetManager() { this(new ClasspathFileHandleResolver()); }