本文整理汇总了Java中com.badlogic.gdx.assets.AssetErrorListener类的典型用法代码示例。如果您正苦于以下问题:Java AssetErrorListener类的具体用法?Java AssetErrorListener怎么用?Java AssetErrorListener使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
AssetErrorListener类属于com.badlogic.gdx.assets包,在下文中一共展示了AssetErrorListener类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: MemoryTrackingAssetManager
import com.badlogic.gdx.assets.AssetErrorListener; //导入依赖的package包/类
public MemoryTrackingAssetManager(FileResolverMultiplexer fileResolverMultiplexer) {
super(fileResolverMultiplexer);
currentMemory = 0;
memoryPerFile = new HashMap<String, Integer>();
eventBus = new SafeEventBus(MemoryTrackingAssetManager.class.getSimpleName());
setErrorListener(new AssetErrorListener() {
@Override
public void error(AssetDescriptor asset, Throwable throwable) {
AssetLoadErrorEvent event = Pools.obtain(AssetLoadErrorEvent.class);
event.setFileName(asset.fileName);
event.setType(asset.type);
events().post(event);
Pools.free(event);
}
});
}
示例2: create
import com.badlogic.gdx.assets.AssetErrorListener; //导入依赖的package包/类
@Override
public void create () {
float w = Gdx.graphics.getWidth();
float h = Gdx.graphics.getHeight();
camera = new OrthographicCamera();
camera.setToOrtho(false, (w / h) * 10, 10);
camera.zoom = 2;
camera.update();
cameraController = new OrthoCamController(camera);
Gdx.input.setInputProcessor(cameraController);
font = new BitmapFont();
batch = new SpriteBatch();
AtlasTiledMapLoaderParameters params = new AtlasTiledMapLoaderParameters();
params.forceTextureFilters = true;
params.textureMinFilter = TextureFilter.Linear;
params.textureMagFilter = TextureFilter.Linear;
assetManager = new AssetManager();
assetManager.setErrorListener(new AssetErrorListener() {
@Override
public void error (AssetDescriptor asset, Throwable throwable) {
errorMessage = throwable.getMessage();
}
});
assetManager.setLoader(TiledMap.class, new AtlasTmxMapLoader(new InternalFileHandleResolver()));
assetManager.load(fileName, TiledMap.class);
}
示例3: Assets
import com.badlogic.gdx.assets.AssetErrorListener; //导入依赖的package包/类
public Assets() {
inst = this;
manager = new AssetManager();
manager.setErrorListener(new AssetErrorListener() {
@Override
public void error(AssetDescriptor assetDescriptor, Throwable throwable) {
Log.error(assetDescriptor.toString());
Log.error(throwable.getMessage());
}
});
manager.getLogger().setLevel(Logger.DEBUG);
}
示例4: Assets
import com.badlogic.gdx.assets.AssetErrorListener; //导入依赖的package包/类
public Assets(Files files) {
setEnumNames(false);
this.files = files;
listeners = new Array<AssetLoadingListener>();
assetManager = new AssetManager(this);
assetManager.setErrorListener(this);
i18n = new I18N(this);
setLoader(Skin.class, new ExtendedSkinLoader(this));
setLoader(Texture.class, new URLTextureLoader(this));
setLoader(SkeletonData.class, new SkeletonLoader(this));
assetManager.setErrorListener(new AssetErrorListener() {
@Override
public void error(AssetDescriptor asset, Throwable throwable) {
AssetLoaderParameters params = asset.params;
if (params != null) {
LoadedCallback loadedCallback = params.loadedCallback;
if (loadedCallback instanceof ErrorCallback) {
((ErrorCallback) loadedCallback).errored(
asset.fileName, asset.type, throwable);
}
} else {
Gdx.app.error("Assets", "Exception loading asset",
throwable);
}
}
});
}