當前位置: 首頁>>代碼示例>>Java>>正文


Java AssetDescriptor類代碼示例

本文整理匯總了Java中com.badlogic.gdx.assets.AssetDescriptor的典型用法代碼示例。如果您正苦於以下問題:Java AssetDescriptor類的具體用法?Java AssetDescriptor怎麽用?Java AssetDescriptor使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


AssetDescriptor類屬於com.badlogic.gdx.assets包,在下文中一共展示了AssetDescriptor類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: getDependencies

import com.badlogic.gdx.assets.AssetDescriptor; //導入依賴的package包/類
@SuppressWarnings({ "unchecked", "rawtypes" })
@Override
public Array<AssetDescriptor> getDependencies(String fileName, FileHandle tmxFile,
		com.badlogic.gdx.maps.tiled.AtlasTmxMapLoader.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 = Gdx.files.internal(value);
					dependencies.add(new AssetDescriptor(atlasHandle, TextureAtlas.class));
				}
			}
		}
	} catch (IOException e) {
		throw new GdxRuntimeException("Unable to parse .tmx file.");
	}
	return dependencies;
}
 
開發者ID:kyperbelt,項目名稱:KyperBox,代碼行數:25,代碼來源:KyperMapLoader.java

示例2: handleImports

import com.badlogic.gdx.assets.AssetDescriptor; //導入依賴的package包/類
public static <T, P extends AssetLoaderParameters<T>> void handleImports(
		AssetLoader<T, P> loader, P parameter,
		@SuppressWarnings("rawtypes") Array<AssetDescriptor> dependencies, FileHandle parentFile,
		Element root) throws IOException {
	Array<Element> imports = root.getChildrenByName(XMLUtil.XML_IMPORT);
	for (Element singleImport : imports) {
		String filename = singleImport.get(XMLUtil.XML_FILENAME);
		FileHandle file = parentFile.parent().child(filename);
		if (!file.exists()) {
			throw new GdxRuntimeException("Import " + file.path()
					+ " from import for " + parentFile.name()
					+ " does not exist.");
		}
		dependencies.addAll(loader.getDependencies(filename, file, parameter));
	}
}
 
開發者ID:mganzarcik,項目名稱:fabulae,代碼行數:17,代碼來源:LoaderUtil.java

示例3: getDependencies

import com.badlogic.gdx.assets.AssetDescriptor; //導入依賴的package包/類
@SuppressWarnings("rawtypes")
@Override
public Array<AssetDescriptor> getDependencies (String fileName, FileHandle file, ProjectileTypeParameter parameter) {
	XmlReader xmlReader = new XmlReader();
	try {
		Array<AssetDescriptor>  returnValue = new Array<AssetDescriptor>();
		Element root = xmlReader.parse(file);
		LoaderUtil.handleImports(this, parameter, returnValue, file, root);
		String animationFile = root.get(ProjectileType.XML_ANIMATION_FILE, null);
		if (animationFile != null) {
			returnValue.add(new AssetDescriptor<Texture>(Configuration.addModulePath(animationFile), Texture.class));
		}
		Element soundsElement = root.getChildByName(XMLUtil.XML_SOUNDS);
		if (soundsElement != null) {
			addSoundDependency(soundsElement, ProjectileType.XML_ON_START, returnValue);
			addSoundDependency(soundsElement, ProjectileType.XML_ON_HIT, returnValue);
			addSoundDependency(soundsElement, ProjectileType.XML_DURING, returnValue);
		}
		if (returnValue.size > 0) {
			return returnValue;
		}
	} catch (IOException e) {
		throw new GdxRuntimeException(e);
	}
	return null;
}
 
開發者ID:mganzarcik,項目名稱:fabulae,代碼行數:27,代碼來源:ProjectileTypeLoader.java

示例4: getDependencies

import com.badlogic.gdx.assets.AssetDescriptor; //導入依賴的package包/類
@SuppressWarnings({ "rawtypes", "unchecked" })
@Override
public Array<AssetDescriptor> getDependencies (String fileName, FileHandle file, WeatherProfileParameter parameter) {
	Array<AssetDescriptor> returnValue = new Array<AssetDescriptor>();
	try {
		XmlReader xmlReader = new XmlReader();
		Element root = xmlReader.parse(file);
		LoaderUtil.handleImports(this, parameter, returnValue, file, root);
		Array<Element> trackElements = root.getChildrenByNameRecursively(WeatherProfile.XML_TRACK);
		for (Element trackElement : trackElements) {
			String trackFileName = Configuration.addModulePath(trackElement.get(XMLUtil.XML_ATTRIBUTE_FILENAME));
			returnValue.add(new AssetDescriptor(trackFileName, WeatherProfile.XML_CONTINOUS.equalsIgnoreCase(trackElement.getParent().getName()) ? Music.class : Sound.class)); 
		}
	} catch (IOException e) {
		throw new GdxRuntimeException(e);
	}
	
	return returnValue;
}
 
開發者ID:mganzarcik,項目名稱:fabulae,代碼行數:20,代碼來源:WeatherProfileLoader.java

示例5: getDependencies

import com.badlogic.gdx.assets.AssetDescriptor; //導入依賴的package包/類
@SuppressWarnings("rawtypes")
@Override
public Array<AssetDescriptor> getDependencies (String fileName, FileHandle file, TrapParameter parameter) {
	XmlReader xmlReader = new XmlReader();
	try {
		Array<AssetDescriptor>  returnValue = new Array<AssetDescriptor>();
		Element root = xmlReader.parse(file);
		LoaderUtil.handleImports(this, parameter, returnValue, file, root);
		Element soundsElement = root.getChildByName(XMLUtil.XML_SOUNDS);
		if (soundsElement != null) {
			addSoundDependency(soundsElement, TrapType.XML_DISARMED, returnValue);
			addSoundDependency(soundsElement, TrapType.XML_SPRUNG, returnValue);
		}
		if (returnValue.size > 0) {
			return returnValue;
		}
	} catch (IOException e) {
		throw new GdxRuntimeException(e);
	}
	return null;
}
 
開發者ID:mganzarcik,項目名稱:fabulae,代碼行數:22,代碼來源:TrapLoader.java

示例6: getDependencies

import com.badlogic.gdx.assets.AssetDescriptor; //導入依賴的package包/類
@Override
public Array<AssetDescriptor> getDependencies(String fileName,
		FileHandle file, Parameter parameter) {
	
	JsonValue root = reader.parse(file);
	String spineFile = root.getString("spine");
	
	Array<AssetDescriptor> dependencies = new Array<AssetDescriptor>();
	dependencies.add(new AssetDescriptor(
		spineFile,
		SkeletonData.class,
		getSkeletonParameters(spineFile)
	));
	
	return dependencies;
}
 
開發者ID:saltares,項目名稱:libgdxjam,代碼行數:17,代碼來源:AnimationControlLoader.java

示例7: MAIN_FONT_19_PATH

import com.badlogic.gdx.assets.AssetDescriptor; //導入依賴的package包/類
public final AssetDescriptor<BitmapFont> MAIN_FONT_19_PATH() {
	FreeTypeFontLoaderParameter font = new FreeTypeFontLoaderParameter();
	font.fontFileName = "fonts/AlemdraSC/AlmendraSC-Regular.ttf";
	font.fontParameters.size = 19;
	return new AssetDescriptor<BitmapFont>("mainFont19.ttf",
			BitmapFont.class, font);
}
 
開發者ID:eskalon,項目名稱:ProjektGG,代碼行數:8,代碼來源:LoadingScreen.java

示例8: MAIN_FONT_22_PATH

import com.badlogic.gdx.assets.AssetDescriptor; //導入依賴的package包/類
public final AssetDescriptor<BitmapFont> MAIN_FONT_22_PATH() {
	FreeTypeFontLoaderParameter font = new FreeTypeFontLoaderParameter();
	font.fontFileName = "fonts/AlemdraSC/AlmendraSC-Regular.ttf";
	font.fontParameters.size = 22;
	return new AssetDescriptor<BitmapFont>("mainFont22.ttf",
			BitmapFont.class, font);
}
 
開發者ID:eskalon,項目名稱:ProjektGG,代碼行數:8,代碼來源:LoadingScreen.java

示例9: LETTER_FONT_20_PATH

import com.badlogic.gdx.assets.AssetDescriptor; //導入依賴的package包/類
public final AssetDescriptor<BitmapFont> LETTER_FONT_20_PATH() {
	FreeTypeFontLoaderParameter font = new FreeTypeFontLoaderParameter();
	font.fontFileName = "fonts/Fredericka_the_Great/FrederickatheGreat-Regular.ttf";
	font.fontParameters.size = 20;
	return new AssetDescriptor<BitmapFont>("letterFont20.ttf",
			BitmapFont.class, font);
}
 
開發者ID:eskalon,項目名稱:ProjektGG,代碼行數:8,代碼來源:LoadingScreen.java

示例10: HANDWRITTEN_FONT_20_PATH

import com.badlogic.gdx.assets.AssetDescriptor; //導入依賴的package包/類
public final AssetDescriptor<BitmapFont> HANDWRITTEN_FONT_20_PATH() {
	FreeTypeFontLoaderParameter font = new FreeTypeFontLoaderParameter();
	font.fontFileName = "fonts/ReenieBeanie/ReenieBeanie.ttf";
	font.fontParameters.size = 20;
	return new AssetDescriptor<BitmapFont>("handwrittenFont20.ttf",
			BitmapFont.class, font);
}
 
開發者ID:eskalon,項目名稱:ProjektGG,代碼行數:8,代碼來源:LoadingScreen.java

示例11: update

import com.badlogic.gdx.assets.AssetDescriptor; //導入依賴的package包/類
@Override
public synchronized boolean update () {
    boolean done = super.update();
    if (done) {
        // assign references to Asset fields of queuedContainers
        for (Object assetContainer : queuedContainers) {
            ObjectMap<Field, AssetDescriptor<?>> fieldsToAssets = containersFieldsToAssets.get(assetContainer);
            for (ObjectMap.Entry<Field, AssetDescriptor<?>> fieldEntry : fieldsToAssets) {
                Field field = fieldEntry.key;
                makeAccessible(field);
                try {
                    field.set(assetContainer, get(fieldEntry.value));
                } catch (ReflectionException e) {
                    throw new GdxRuntimeException("Failed to assign loaded asset " + field.getName(), e);
                }
            }
            ObjectMap<Object[], AssetDescriptor<?>[]> fieldsToAssetArrays = containersFieldsToAssetArrays.get(assetContainer);
            for (ObjectMap.Entry<Object[], AssetDescriptor<?>[]> arrayEntry : fieldsToAssetArrays) {
                Object[] destinationArray = arrayEntry.key;
                AssetDescriptor<?>[] descriptors = arrayEntry.value;
                for (int i = 0; i < descriptors.length; i++) {
                    destinationArray[i] = get(descriptors[i]);
                }
            }

            if (assetContainer instanceof AssetContainer)
                ((AssetContainer) assetContainer).onAssetsLoaded();
        }

        loadedContainers.addAll(queuedContainers);
        queuedContainers.clear();
    }
    return done;
}
 
開發者ID:CypherCove,項目名稱:gdx-cclibs,代碼行數:35,代碼來源:AssignmentAssetManager.java

示例12: error

import com.badlogic.gdx.assets.AssetDescriptor; //導入依賴的package包/類
@Override
public void error(AssetDescriptor asset, Throwable throwable) {
    try {
        throw throwable;
    } catch (Throwable e) {
        Logger.getInstance().error(e.getMessage());
        e.printStackTrace();
    }
}
 
開發者ID:unlimitedggames,項目名稱:gdxjam-ugg,代碼行數:10,代碼來源:LoaderUtils.java

示例13: error

import com.badlogic.gdx.assets.AssetDescriptor; //導入依賴的package包/類
@Override
public void error(AssetDescriptor asset, Throwable throwable) {
    try {
        throw throwable;
    } catch (Throwable throwable1) {
        throwable1.printStackTrace();
    }
}
 
開發者ID:MovementSpeed,項目名稱:nhglib,代碼行數:9,代碼來源:Assets.java

示例14: getDependencies

import com.badlogic.gdx.assets.AssetDescriptor; //導入依賴的package包/類
@Override
public Array<AssetDescriptor> getDependencies(String fileName, FileHandle file, P parameters) {
    final Array<AssetDescriptor> deps = new Array();
    ModelData data = loadModelData(file, parameters);
    if (data == null) return deps;

    ObjectMap.Entry<String, ModelData> item = new ObjectMap.Entry<String, ModelData>();
    item.key = fileName;
    item.value = data;

    synchronized (items) {
        items.add(item);
    }

    TextureLoader.TextureParameter textureParameter = (parameters != null)
            ? parameters.textureParameter
            : defaultParameters.textureParameter;

    for (final ModelMaterial modelMaterial : data.materials) {
        if (modelMaterial.textures != null) {
            for (final ModelTexture modelTexture : modelMaterial.textures) {
                String fName = modelTexture.fileName;

                if (fName.contains("/")) {
                    fName = fName.substring(fName.lastIndexOf("/") + 1);
                }

                deps.add(new AssetDescriptor(currentAsset.dependenciesPath + fName, Texture.class, textureParameter));
            }
        }
    }

    return deps;
}
 
開發者ID:MovementSpeed,項目名稱:nhglib,代碼行數:35,代碼來源:NhgModelLoader.java

示例15: loadLevelAsset

import com.badlogic.gdx.assets.AssetDescriptor; //導入依賴的package包/類
private void loadLevelAsset(
    AssetManager assMan,
    LevelParameters levelParameters,
    String assetPath,
    Class assetClass)
{
    @SuppressWarnings("unchecked")
    AssetDescriptor assetDescriptor =
        new AssetDescriptor(assetPath, assetClass);
    assMan.load(assetDescriptor);
    levelParameters.dependencies.add(assetDescriptor);
}
 
開發者ID:overengineering,項目名稱:space-travels-3,代碼行數:13,代碼來源:LoadingScreen.java


注:本文中的com.badlogic.gdx.assets.AssetDescriptor類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。