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