本文整理汇总了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);
}