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


Java AssetManager.setLoader方法代码示例

本文整理汇总了Java中com.badlogic.gdx.assets.AssetManager.setLoader方法的典型用法代码示例。如果您正苦于以下问题:Java AssetManager.setLoader方法的具体用法?Java AssetManager.setLoader怎么用?Java AssetManager.setLoader使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.badlogic.gdx.assets.AssetManager的用法示例。


在下文中一共展示了AssetManager.setLoader方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: loadAssets

import com.badlogic.gdx.assets.AssetManager; //导入方法依赖的package包/类
private void loadAssets() {
    InternalFileHandleResolver fileHandler = new InternalFileHandleResolver();
    assetManager = new AssetManager(fileHandler);
    assetManager.setLoader(FreeTypeFontGenerator.class, new FreeTypeFontGeneratorLoader(fileHandler));

    assetManager.load(SKIN_PATH, Skin.class);
    assetManager.load(MASTER_PATH, TextureAtlas.class);
    assetManager.load(FONT_NORMAL_PATH, FreeTypeFontGenerator.class);
    assetManager.load(FONT_BOLD_PATH, FreeTypeFontGenerator.class);
    assetManager.load(MUSIC_PATH, Music.class);
    assetManager.load(MAIN_MENU_MUSIC_PATH, Music.class);
    assetManager.load(GOOD_PATH, Sound.class);
    assetManager.load(HALF_PATH, Sound.class);
    assetManager.load(BAD_PATH, Sound.class);
    assetManager.finishLoading();
}
 
开发者ID:DurianHLN,项目名称:Polymorph,代码行数:17,代码来源:Polymorph.java

示例2: show

import com.badlogic.gdx.assets.AssetManager; //导入方法依赖的package包/类
@Override
public void show() {
    super.show();
    layout = new GlyphLayout();
    font = new NativeFont(new NativeFontPaint(25));
    font.appendText("正在加载...0123456789%");
    font.setColor(Color.BLACK);
    layout.setText(font, "正在加载...100%");

    stage = new Stage(new StretchViewport(1280, 720));

    assetManager = new AssetManager();
    assetManager.setLogger(new Logger("log", Logger.DEBUG));
    assetManager.setLoader(CocosScene.class, new CocosLoader(new InternalFileHandleResolver()));
    assetManager.load("mainscene/MenuScene.json", CocosScene.class);
}
 
开发者ID:varFamily,项目名称:cocos-ui-libgdx,代码行数:17,代码来源:AMScreen.java

示例3: create

import com.badlogic.gdx.assets.AssetManager; //导入方法依赖的package包/类
@Override
public void create() {
	game_prefs = Gdx.app.getPreferences(prefs_name);

	game_stage = new Stage(view);
	game_states = new ObjectMap<String, GameState>();
	game_stage.setDebugAll(false);

	current_gamestates = new Array<GameState>();
	transition_state = new GameState(null);
	transition_state.setGame(this);

	assets = new AssetManager();
	assets.setLoader(TiledMap.class, new KyperMapLoader(assets.getFileHandleResolver()));
	assets.setLoader(ParticleEffect.class, new ParticleEffectLoader(assets.getFileHandleResolver()));
	assets.setLoader(ShaderProgram.class,
			new ShaderProgramLoader(assets.getFileHandleResolver(), VERTEX_SUFFIX, FRAGMENT_SUFFIX));
	sound = new SoundManager(this);

	packages = new Array<String>();
	packages.add("com.kyperbox.objects");

	global_data = new UserData(GAME_DATA_NAME);
	input = new GameInput();

	Gdx.input.setInputProcessor(game_stage);

	initiate();
}
 
开发者ID:kyperbelt,项目名称:KyperBox,代码行数:30,代码来源:KyperBoxGame.java

示例4: MapMode

import com.badlogic.gdx.assets.AssetManager; //导入方法依赖的package包/类
MapMode(final MapDefinition initialMap, final TileCoordinate initialLocation,
        final AssetManager assetManager) {
    this.initialMap = initialMap;
    this.initialLocation = initialLocation;
    this.assetManager = assetManager;
    assetManager.setLoader(TiledMap.class, new TmxMapLoader(new InternalFileHandleResolver()));
    this.heroSpriteSet = GameState.getParty().getLeader().getSpriteSetDefinition();
    stateMachine = initStateMachine();
}
 
开发者ID:JayStGelais,项目名称:jrpg-engine,代码行数:10,代码来源:MapMode.java

示例5: LoaderUtils

import com.badlogic.gdx.assets.AssetManager; //导入方法依赖的package包/类
public LoaderUtils() {
    resolver = new ResolutionFileResolver(new InternalFileHandleResolver(), resolutions);
    assetManager = new AssetManager(resolver);
    assetManager.setErrorListener(this);
    Texture.setAssetManager(assetManager);
    assetManager.setLoader(I18NBundle.class, new I18NBundleLoader(resolver));

    GUIConfig.initializeValues(resolutions);

    this.atlas = null;
    this.regions = new ObjectMap<String, AtlasRegion>();

}
 
开发者ID:unlimitedggames,项目名称:gdxjam-ugg,代码行数:14,代码来源:LoaderUtils.java

示例6: init

import com.badlogic.gdx.assets.AssetManager; //导入方法依赖的package包/类
public void init(Nhg nhg) {
    this.nhg = nhg;
    fsm = new DefaultStateMachine<>(this, AssetsStates.IDLE);

    assetManager = new AssetManager();
    syncAssetManager = new AssetManager();

    FileHandleResolver resolver = assetManager.getFileHandleResolver();
    FileHandleResolver syncResolver = syncAssetManager.getFileHandleResolver();

    assetManager.setLoader(Scene.class, new SceneLoader(nhg, resolver));
    assetManager.setLoader(InputProxy.class, new InputLoader(resolver));
    assetManager.setLoader(JsonValue.class, new JsonLoader(resolver));
    assetManager.setLoader(HDRData2.class, new HDRLoader(resolver));
    assetManager.setLoader(Model.class, ".g3db", new NhgG3dModelLoader(this,
            new UBJsonReader(), resolver));

    syncAssetManager.setLoader(Scene.class, new SceneLoader(nhg, syncResolver));
    syncAssetManager.setLoader(InputProxy.class, new InputLoader(syncResolver));
    syncAssetManager.setLoader(JsonValue.class, new JsonLoader(syncResolver));
    syncAssetManager.setLoader(HDRData2.class, new HDRLoader(syncResolver));
    syncAssetManager.setLoader(Model.class, ".g3db", new NhgG3dModelLoader(this,
            new UBJsonReader(), syncResolver));

    assetManager.setErrorListener(this);
    syncAssetManager.setErrorListener(this);

    assetQueue = new Array<>();
    assetCache = new ArrayMap<>();

    Texture.setAssetManager(assetManager);
}
 
开发者ID:MovementSpeed,项目名称:nhglib,代码行数:33,代码来源:Assets.java

示例7: create

import com.badlogic.gdx.assets.AssetManager; //导入方法依赖的package包/类
public static void create()
{
    GAME_ASSET_MANAGER = new AssetManager();
    GAME_ASSET_MANAGER.setLoader(Joystick.class, new JoystickLoader());
    GAME_ASSET_MANAGER.setLoader(Level.class, new LevelLoader());
    GAME_ASSET_MANAGER.setLoader(CollisionCache.class, new CollisionCacheLoader());

    ASSET_MANAGER = new AssetManager();
    ASSET_MANAGER.setLoader(Background.class, new BackgroundLoader());

    ASSET_LIST = new Json().fromJson(
        AssList.class,
        Gdx.files.internal("assetList.json").readString());
}
 
开发者ID:overengineering,项目名称:space-travels-3,代码行数:15,代码来源:AssMan.java

示例8: initLoader

import com.badlogic.gdx.assets.AssetManager; //导入方法依赖的package包/类
private void initLoader() {
    manager = new AssetManager();
    manager.setLoader(ArgentAsset.class, new ArgentAssetLoader(manager.getFileHandleResolver()));
    assetMap = new HashMap<>();
    assetTypes = new HashMap<>();
    fileRoots = new FileRoot[0];
}
 
开发者ID:ncguy2,项目名称:Argent,代码行数:8,代码来源:ContentManager.java

示例9: 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.setLoader方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。