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


Java AssetManager.isLoaded方法代碼示例

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


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

示例1: loadAsyncImages

import com.badlogic.gdx.assets.AssetManager; //導入方法依賴的package包/類
protected void loadAsyncImages()
{
    // Check if we need to load level icons and if they are loaded show them.
    if (!this.asyncImages.isEmpty())
    {
        AssetManager assMan = AssMan.getAssMan();

        ArrayList<String> texturePaths =
            new ArrayList<>(this.asyncImages.keySet());
        for (String texturePath : texturePaths)
        {
            if (assMan.update()
                || assMan.isLoaded(texturePath))
            {
                Texture texture = assMan.get(texturePath);
                texture.setFilter(Texture.TextureFilter.Linear, Texture.TextureFilter.Linear);
                this.asyncImages.get(texturePath)
                    .setDrawable(new TextureRegionDrawable(new TextureRegion(texture)));

                this.asyncImages.remove(texturePath);
            }
        }
    }
}
 
開發者ID:overengineering,項目名稱:space-travels-3,代碼行數:25,代碼來源:Screen.java

示例2: loadSpriteSheet

import com.badlogic.gdx.assets.AssetManager; //導入方法依賴的package包/類
protected final TextureRegion[][] loadSpriteSheet(final String spriteSheetPath, final AssetManager assetManager,
                                                  final int frameWidth, final int frameHeight) {
    if (!assetManager.isLoaded(spriteSheetPath, Texture.class)) {
        assetManager.load(spriteSheetPath, Texture.class);
        assetManager.finishLoading();
    }
    return TextureRegion.split(assetManager.get(spriteSheetPath, Texture.class), frameWidth, frameHeight);
}
 
開發者ID:JayStGelais,項目名稱:jrpg-engine,代碼行數:9,代碼來源:SpriteSetDefinition.java

示例3: loadMap

import com.badlogic.gdx.assets.AssetManager; //導入方法依賴的package包/類
protected final GameMap loadMap(final GraphicsService graphicsService, final AssetManager assetManager,
                                final String mapPath, final Location parentLocation) {
    if (!assetManager.isLoaded(mapPath, TiledMap.class)) {
        assetManager.load(mapPath, TiledMap.class);
        assetManager.finishLoading();
    }
    TiledMap tiledMap = assetManager.get(mapPath);
    TiledMapRenderer mapRenderer = graphicsService.getTileMapRenderer(tiledMap);
    return new GameMap(graphicsService.getCamera(), tiledMap, mapRenderer, parentLocation);
}
 
開發者ID:JayStGelais,項目名稱:jrpg-engine,代碼行數:11,代碼來源:MapDefinition.java

示例4: getLightTexture

import com.badlogic.gdx.assets.AssetManager; //導入方法依賴的package包/類
static Texture getLightTexture(final AssetManager assetManager) {
    if (!assetManager.isLoaded(LIGHT_TEXTURE, Texture.class)) {
        assetManager.load(LIGHT_TEXTURE, Texture.class);
        assetManager.finishLoading();
    }
    return assetManager.get(LIGHT_TEXTURE, Texture.class);
}
 
開發者ID:JayStGelais,項目名稱:jrpg-engine,代碼行數:8,代碼來源:LightSource.java

示例5: getPrefab

import com.badlogic.gdx.assets.AssetManager; //導入方法依賴的package包/類
/** Loads the PrefabDescriber if it isn't yet loaded and then makes a GameObject out of it
 * 
 * @param path - the path to the File containing the PrefabDescription
 * @return the GameObject made out of the Prefab */
public static GameObject getPrefab (String path) {
	AssetManager assetManager = RavTech.files.getAssetManager();
	if (!assetManager.isLoaded(path)) {
		assetManager.load(path, String.class);
		assetManager.finishLoading();
	}
	String prefabString = assetManager.get(path);
	Debug.startTimer("Prefab");
	GameObject object = makeObject(prefabString);
	Debug.endTimer("Prefab");
	return object;
}
 
開發者ID:Quexten,項目名稱:RavTech,代碼行數:17,代碼來源:PrefabManager.java

示例6: add

import com.badlogic.gdx.assets.AssetManager; //導入方法依賴的package包/類
/** Adds new shader to ShaderManager, loads it using AssetManager.
 * 
 * @param am - AssetManager instance
 * @param key - shader identifier
 * @param baseVertPath - path to vertex shader source
 * @param baseFragPath - path to fragment shader source */
public void add (AssetManager am, String key, String baseVertPath, String baseFragPath) {
	am.setLoader(String.class, new TextFileLoader(new InternalFileHandleResolver()));
	FileHandle vertFh = null, fragFh = null;
	String vertPath = shaderDir + "/" + baseVertPath;
	vertFh = Gdx.files.internal(vertPath);
	if (!vertFh.exists()) {
		vertFh = Gdx.files.classpath(SHADER_CLASSPATH + "/" + baseVertPath);
		vertPath = vertFh.path();
	}
	String fragPath = shaderDir + "/" + baseFragPath;
	fragFh = Gdx.files.internal(fragPath);
	if (!fragFh.exists()) {
		fragFh = Gdx.files.classpath(SHADER_CLASSPATH + "/" + baseFragPath);
		fragPath = fragFh.path();
	}
	if (!vertFh.exists())
		throw new GdxRuntimeException("ShaderManager: shader '" + vertPath + "' does not exist!");
	if (!fragFh.exists())
		throw new GdxRuntimeException("ShaderManager: shader '" + fragPath + "' does not exist!");
	if (am.isLoaded(vertPath))
		am.unload(vertPath);
	if (am.isLoaded(fragPath))
		am.unload(fragPath);
	am.load(vertPath, String.class);
	am.load(fragPath, String.class);
	// TODO dirty...
	while (!am.isLoaded(vertPath) || !am.isLoaded(fragPath))
		am.update();
	// Gdx.app.log("ShaderManager", am.getProgress() + ", " +
	// am.getLoadedAssets() + "/" + am.getQueuedAssets());
	String vert = am.get(vertPath, String.class);
	String frag = am.get(fragPath, String.class);
	if (init(key, vert, frag))
		shaderPaths.put(key, baseVertPath + ";" + baseFragPath);
}
 
開發者ID:Quexten,項目名稱:RavTech,代碼行數:42,代碼來源:ShaderManager.java


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