本文整理匯總了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);
}
}
}
}
示例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);
}
示例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);
}
示例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);
}
示例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;
}
示例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);
}