当前位置: 首页>>代码示例>>Java>>正文


Java AssetErrorListener类代码示例

本文整理汇总了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);
		}
	});
}
 
开发者ID:frigidplanet,项目名称:droidtowers,代码行数:19,代码来源:MemoryTrackingAssetManager.java

示例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);
}
 
开发者ID:basherone,项目名称:libgdxcn,代码行数:33,代码来源:TiledMapAtlasAssetManagerTest.java

示例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);
}
 
开发者ID:jrenner,项目名称:gdx-proto,代码行数:13,代码来源:Assets.java

示例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);
			}
		}
	});
}
 
开发者ID:e-ucm,项目名称:ead,代码行数:28,代码来源:Assets.java


注:本文中的com.badlogic.gdx.assets.AssetErrorListener类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。