com.badlogic.gdx.assets.AssetDescriptor Java Examples
The following examples show how to use
com.badlogic.gdx.assets.AssetDescriptor.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: GameLoadingScreen.java From riiablo with Apache License 2.0 | 6 votes |
@Override public void show() { Gdx.app.log(TAG, "Loading act " + (act + 1)); Riiablo.viewport = Riiablo.defaultViewport; Riiablo.assets.load(loadingscreenDescriptor); if (dependencies != null) { for (AssetDescriptor asset : dependencies) { Riiablo.assets.load(asset); } dependencies = null; } map.setAct(act); map.load(); }
Example #2
Source File: UAtlasTmxMapLoader.java From uracer-kotd with Apache License 2.0 | 6 votes |
@Override public Array<AssetDescriptor> getDependencies (String fileName, FileHandle tmxFile, AtlasTiledMapLoaderParameters parameter) { Array<AssetDescriptor> dependencies = new Array<AssetDescriptor>(); try { root = xml.parse(tmxFile); Element properties = root.getChildByName("properties"); if (properties != null) { for (Element property : properties.getChildrenByName("property")) { String name = property.getAttribute("name"); String value = property.getAttribute("value"); if (name.startsWith("atlas")) { FileHandle atlasHandle = getRelativeFileHandle(tmxFile, value); dependencies.add(new AssetDescriptor(atlasHandle, TextureAtlas.class)); } } } } catch (IOException e) { throw new GdxRuntimeException("Unable to parse .tmx file."); } return dependencies; }
Example #3
Source File: CofUnloader.java From riiablo with Apache License 2.0 | 5 votes |
private void unload(int entityId) { if (!mCofDescriptor.has(entityId)) return; CofDescriptor cofDescriptor = mCofDescriptor.get(entityId); AssetDescriptor<COF> descriptor = cofDescriptor.descriptor; if (DEBUG) Gdx.app.debug(TAG, "Unloading " + descriptor.fileName); Riiablo.assets.unload(descriptor.fileName); mCofDescriptor.remove(entityId); }
Example #4
Source File: Map.java From riiablo with Apache License 2.0 | 5 votes |
Array<AssetDescriptor> getDependencies() { if (dependencies == EMPTY_ASSET_ARRAY) { dependencies = new Array<>(false, 64); for (Preset[] x : presets) for (Preset y : x) if (y != null) dependencies.addAll(y.getDependencies(type)); } return dependencies; }
Example #5
Source File: Map.java From riiablo with Apache License 2.0 | 5 votes |
@Override public void dispose() { x = y = 0; width = height = 0; gridSizeX = gridSizeY = 0; gridsX = gridsY = 0; tx = ty = 0; tilesX = tilesY = 0; free(flags); flags = null; for (DT1.Tile[] layer : tiles) free(layer); Arrays.fill(tiles, null); //for (Preset[] x : presets) for (Preset y : x) if (y != null) y.dispose(); presets = null; for (AssetDescriptor asset : dependencies) Riiablo.assets.unload(asset.fileName); dependencies = EMPTY_ASSET_ARRAY; dt1s = null; // TODO: setting null -- depending on Map dispose to clear DT1s on act change town = false; entities = EMPTY_ENTITY_ARRAY; warps = EMPTY_INT_INT_MAP; generator = EMPTY_GENERATOR; specials = EMPTY_INT_CELL_MAP; }
Example #6
Source File: Audio.java From riiablo with Apache License 2.0 | 5 votes |
static Instance obtain(AssetDescriptor descriptor, Object delegate, long id) { Instance instance = Pools.obtain(Instance.class); instance.descriptor = descriptor; instance.stream = delegate instanceof Music; instance.delegate = delegate; instance.id = id; return instance; }
Example #7
Source File: QuestsPanel.java From riiablo with Apache License 2.0 | 5 votes |
@Override public void dispose() { Riiablo.assets.unload(questbackgroundDescriptor.fileName); Riiablo.assets.unload(expquesttabsDescriptor.fileName); Riiablo.assets.unload(questlastDescriptor.fileName); Riiablo.assets.unload(buysellbtnDescriptor.fileName); Riiablo.assets.unload(questdoneDescriptor.fileName); Riiablo.assets.unload(questsocketsDescriptor.fileName); for (AssetDescriptor assetDescriptor : questiconsDescriptor) Riiablo.assets.unload(assetDescriptor.fileName); }
Example #8
Source File: LoadingScreen.java From riiablo with Apache License 2.0 | 5 votes |
public LoadingScreen(Array<AssetDescriptor> assets, Screen screen) { this.screen = screen; stage = new Stage(Riiablo.defaultViewport, Riiablo.batch); Riiablo.assets.load(loadingscreenDescriptor); Riiablo.assets.finishLoadingAsset(loadingscreenDescriptor); final Animation loadingscreen = Animation.newAnimation(Riiablo.assets.get(loadingscreenDescriptor)); loadingscreen.setFrameDuration(Float.MAX_VALUE); loadingscreenWrapper = new AnimationWrapper(loadingscreen) { @Override public void act(float delta) { super.act(delta); for (Animation animation : animations) { animation.setFrame((int) (Riiablo.assets.getProgress() * (animation.getNumFramesPerDir() - 1))); } } }; loadingscreenWrapper.setPosition( (stage.getWidth() / 2) - (loadingscreen.getMinWidth() / 2), (stage.getHeight() / 2) - (loadingscreen.getMinHeight() / 2)); stage.addActor(loadingscreenWrapper); this.assets = assets; if (assets != null) { for (AssetDescriptor asset : assets) { Riiablo.assets.load(asset); } } }
Example #9
Source File: CCTextureAtlasLoader.java From cocos-ui-libgdx with Apache License 2.0 | 5 votes |
@Override public Array<AssetDescriptor> getDependencies(String fileName, FileHandle file, TextureAtlasLoader.TextureAtlasParameter parameter) { FileHandle imgDir = file.parent(); map = LyU.createDictionaryWithContentsOfFile(file); ObjectMap<String, Object> metadata = (ObjectMap<String, Object>) map.get("metadata"); String dependFile = (String) metadata.get("textureFileName"); Array<AssetDescriptor> res = new Array<AssetDescriptor>(); TextureLoader.TextureParameter params = new TextureLoader.TextureParameter(); params.magFilter = Texture.TextureFilter.Linear; params.minFilter = Texture.TextureFilter.Linear; params.format = Pixmap.Format.RGBA8888; texture = new Texture(imgDir.child(dependFile)); res.add(new AssetDescriptor(imgDir.child(dependFile), Texture.class, params)); return res; }
Example #10
Source File: CofLayerLoader.java From riiablo with Apache License 2.0 | 5 votes |
void unload(int c, AssetDescriptor[] descriptors) { AssetDescriptor descriptor = descriptors[c]; if (descriptor == null) return; descriptors[c] = null; Riiablo.assets.unload(descriptor.fileName); if (DEBUG) Gdx.app.debug(TAG, "Unloading[" + Engine.getComposite(c) + "] " + descriptor.fileName); }
Example #11
Source File: CofLoader.java From riiablo with Apache License 2.0 | 5 votes |
@Subscribe public void onCofChanged(CofChangeEvent event) { if (DEBUG_EVENTS) Gdx.app.debug(TAG, "inserted"); AssetDescriptor<COF> descriptor = mCofDescriptor.get(event.entityId).descriptor; Riiablo.assets.load(descriptor); if (DEBUG) Gdx.app.debug(TAG, "Loading " + descriptor.fileName); checkLoaded(event.entityId); }
Example #12
Source File: ThesaurusLoader.java From dice-heroes with GNU General Public License v3.0 | 5 votes |
@Override public Array<AssetDescriptor> getDependencies(String fileName, FileHandle file, ThesaurusLoader.ThesaurusParameter parameter) { if (parameter != null && parameter.other.length > 0) { Array<AssetDescriptor> descriptors = new Array<AssetDescriptor>(); for (String depName : parameter.other) { descriptors.add(new AssetDescriptor<Thesaurus>(depName, Thesaurus.class)); } return descriptors; } return null; }
Example #13
Source File: Assets.java From ud406 with MIT License | 4 votes |
@Override public void error(AssetDescriptor asset, Throwable throwable) { Gdx.app.error(TAG, "Couldn't load asset: " + asset.fileName, throwable); }
Example #14
Source File: Assets.java From ud406 with MIT License | 4 votes |
@Override public void error(AssetDescriptor asset, Throwable throwable) { Gdx.app.error(TAG, "Couldn't load asset: " + asset.fileName, throwable); }
Example #15
Source File: Assets.java From ud406 with MIT License | 4 votes |
@Override public void error(AssetDescriptor asset, Throwable throwable) { Gdx.app.error(TAG, "Couldn't load asset: " + asset.fileName, throwable); }
Example #16
Source File: Assets.java From ud406 with MIT License | 4 votes |
@Override public void error(AssetDescriptor asset, Throwable throwable) { Gdx.app.error(TAG, "Couldn't load asset: " + asset.fileName, throwable); }
Example #17
Source File: MusicController.java From riiablo with Apache License 2.0 | 4 votes |
public void play(AssetDescriptor<Music> asset) { play(asset.fileName); }
Example #18
Source File: Assets.java From ud406 with MIT License | 4 votes |
@Override public void error(AssetDescriptor asset, Throwable throwable) { Gdx.app.error(TAG, "Couldn't load asset: " + asset.fileName, throwable); }
Example #19
Source File: Assets.java From ud406 with MIT License | 4 votes |
@Override public void error(AssetDescriptor asset, Throwable throwable) { Gdx.app.error(TAG, "Couldn't load asset: " + asset.fileName, throwable); }
Example #20
Source File: Assets.java From ud406 with MIT License | 4 votes |
@Override public void error(AssetDescriptor asset, Throwable throwable) { Gdx.app.error(TAG, "Couldn't load asset: " + asset.fileName, throwable); }
Example #21
Source File: Assets.java From ud406 with MIT License | 4 votes |
@Override public void error(AssetDescriptor asset, Throwable throwable) { Gdx.app.error(TAG, "Couldn't load asset: " + asset.fileName, throwable); }
Example #22
Source File: Assets.java From ud406 with MIT License | 4 votes |
@Override public void error(AssetDescriptor asset, Throwable throwable) { Gdx.app.error(TAG, "Couldn't load asset: " + asset.fileName, throwable); }
Example #23
Source File: GameScreen.java From riiablo with Apache License 2.0 | 4 votes |
@Override public Array<AssetDescriptor> getDependencies() { return preloadedAssets; }
Example #24
Source File: Assets.java From ud406 with MIT License | 4 votes |
@Override public void error(AssetDescriptor asset, Throwable throwable) { Gdx.app.error(TAG, "Couldn't load asset: " + asset.fileName, throwable); }
Example #25
Source File: SpellsQuickPanel.java From riiablo with Apache License 2.0 | 4 votes |
public SpellsQuickPanel(final HotkeyButton o, final boolean leftSkills) { this.observer = o; this.leftSkills = leftSkills; Riiablo.assets.load(SkilliconDescriptor); Riiablo.assets.finishLoadingAsset(SkilliconDescriptor); Skillicon = Riiablo.assets.get(SkilliconDescriptor); CharSkilliconDescriptor = new AssetDescriptor[7]; CharSkillicon = new DC6[CharSkilliconDescriptor.length]; for (int i = 0; i < CharSkilliconDescriptor.length; i++) { CharSkilliconDescriptor[i] = new AssetDescriptor<>(SPELLS_PATH + CharacterClass.get(i).spellIcons + ".DC6", DC6.class, DC6Loader.DC6Parameters.COMBINE); Riiablo.assets.load(CharSkilliconDescriptor[i]); Riiablo.assets.finishLoadingAsset(CharSkilliconDescriptor[i]); CharSkillicon[i] = Riiablo.assets.get(CharSkilliconDescriptor[i]); } SIZE = Gdx.app.getType() == Application.ApplicationType.Android ? 64 : 48; ALIGN = leftSkills ? Align.left : Align.right; keyMappings = new ObjectMap<>(31); tables = new Table[5]; for (int i = tables.length - 1; i >= 0; i--) { Table table = tables[i] = new Table(); add(table).align(ALIGN).row(); } pack(); //setDebug(true, true); mappedKeyListener = new MappedKeyStateAdapter() { @Override public void onPressed(MappedKey key, int keycode) { HotkeyButton button = keyMappings.get(key); if (button == null) return; // TODO: Assign ControlPanel controlPanel = Riiablo.game.controlPanel; if (leftSkills) { controlPanel.getLeftSkill().copy(button); } else { controlPanel.getRightSkill().copy(button); } } }; for (MappedKey Skill : Keys.Skill) Skill.addStateListener(mappedKeyListener); Riiablo.charData.addSkillListener(this); }
Example #26
Source File: Fonts.java From riiablo with Apache License 2.0 | 4 votes |
private static AssetDescriptor<FontTBL.BitmapFont> getDescriptor(String fontName, int blendMode) { return new AssetDescriptor<>("data\\local\\font\\latin\\" + fontName + ".TBL", FontTBL.BitmapFont.class, BitmapFontLoader.Params.of(blendMode)); }
Example #27
Source File: Fonts.java From riiablo with Apache License 2.0 | 4 votes |
private FontTBL.BitmapFont load(AssetManager assets, String fontName, int blendMode) { AssetDescriptor<FontTBL.BitmapFont> descriptor = getDescriptor(fontName, blendMode); assets.load(descriptor); assets.finishLoadingAsset(descriptor); return assets.get(descriptor); }
Example #28
Source File: Assets.java From ud406 with MIT License | 4 votes |
@Override public void error(AssetDescriptor asset, Throwable throwable) { Gdx.app.error(TAG, "Couldn't load asset: " + asset.fileName, throwable); }
Example #29
Source File: Item.java From riiablo with Apache License 2.0 | 4 votes |
public Item set(com.riiablo.item.Item item) { this.item = item; this.flippyDescriptor = new AssetDescriptor<>(Class.Type.ITM.PATH + '\\' + item.getFlippyFile() + ".dc6", DC6.class); return this; }
Example #30
Source File: Assets.java From ud406 with MIT License | 4 votes |
@Override public void error(AssetDescriptor asset, Throwable throwable) { Gdx.app.error(TAG, "Couldn't load asset: " + asset.fileName, throwable); }