• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java SoundLoader类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



SoundLoader类属于com.badlogic.gdx.assets.loaders包,在下文中一共展示了SoundLoader类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: loadSoundAsset

import com.badlogic.gdx.assets.loaders.SoundLoader; //导入依赖的package包/类
public static void loadSoundAsset(String soundFilenamePath){
	if( soundFilenamePath == null || "".equals(soundFilenamePath.trim()) ){
		return;
	}
	if( assetManager.isLoaded(soundFilenamePath) ){
		return;
	}
	//load asset
	if( filePathResolver.resolve(soundFilenamePath).exists() ){
		assetManager.setLoader(Sound.class, new SoundLoader(filePathResolver));
		assetManager.load(soundFilenamePath, Sound.class);
		//Until we add loading screen, just block until we load the map
		assetManager.finishLoadingAsset(soundFilenamePath);
		Gdx.app.debug(TAG, "Sound loaded!: " + soundFilenamePath);
	}
	else{
		Gdx.app.debug(TAG, "Sound doesn't exist!: " + soundFilenamePath );
	}
}
 
开发者ID:Mignet,项目名称:Inspiration,代码行数:20,代码来源:Assets.java


示例2: Moon

import com.badlogic.gdx.assets.loaders.SoundLoader; //导入依赖的package包/类
public Moon(final AssetManager manager) {
    manager.setLoader(Texture.class, new TextureLoader(new InternalFileHandleResolver()));
    manager.setLoader(Sound.class, new SoundLoader(new InternalFileHandleResolver()));
    manager.load(TEXTURE_FILENAME, Texture.class);
    manager.load(SFX_MOON_CRASH_FILENAME, Sound.class);
    manager.finishLoading();

    texture = manager.get(TEXTURE_FILENAME);
    crashSfx = manager.get(SFX_MOON_CRASH_FILENAME);

    currentFrame = new TextureRegion(texture);

    setWidth(currentFrame.getRegionWidth());
    setHeight(currentFrame.getRegionHeight());
    setOrigin(getWidth() / 2, getHeight() / 2);

    reset(); 
}
 
开发者ID:broken-shotgun,项目名称:throw-the-moon,代码行数:19,代码来源:Moon.java


示例3: MoonChain

import com.badlogic.gdx.assets.loaders.SoundLoader; //导入依赖的package包/类
public MoonChain(final AssetManager manager) {
    manager.setLoader(Texture.class, new TextureLoader(new InternalFileHandleResolver()));
    manager.setLoader(Sound.class, new SoundLoader(new InternalFileHandleResolver()));
    manager.load(TEXTURE_FILENAME, Texture.class);
    manager.load(SFX_CHAIN_PULL_FILENAME, Sound.class);
    manager.finishLoading();

    texture = manager.get(TEXTURE_FILENAME);
    texture.setWrap(Texture.TextureWrap.ClampToEdge, Texture.TextureWrap.Repeat);
    
    chainPullSfx = manager.get(SFX_CHAIN_PULL_FILENAME);

    setWidth(texture.getWidth());
    setHeight(texture.getHeight() * TILE_COUNT);
    setOrigin(getWidth() / 2, 0);
    
    // Note: scale is not used in draw for the chain, this is a hack to make easier to put the chain down
    setScale(3f, 3f);

    collisionArea = new Rectangle(getX(), getY(), getWidth(), getHeight());
    position = new Vector2(getX(), getY());
}
 
开发者ID:broken-shotgun,项目名称:throw-the-moon,代码行数:23,代码来源:MoonChain.java


示例4: Enemy

import com.badlogic.gdx.assets.loaders.SoundLoader; //导入依赖的package包/类
public Enemy(final AssetManager manager) {
    manager.setLoader(Texture.class, new TextureLoader(new InternalFileHandleResolver()));
    manager.setLoader(Sound.class, new SoundLoader(new InternalFileHandleResolver()));
    manager.load(TEXTURE_FILENAME, Texture.class);
    manager.load(SFX_HIT_FILENAME, Sound.class);
    manager.finishLoading();

    texture = manager.get(TEXTURE_FILENAME);
    regions = TextureRegion.split(texture, FRAME_WIDTH, FRAME_HEIGHT)[0];
    idle = new Animation(0.1f, regions[0], regions[1], regions[2]);
    idle.setPlayMode(Animation.PlayMode.LOOP);

    hitSfx = manager.get(SFX_HIT_FILENAME);

    currentFrame = idle.getKeyFrame(0.0f);

    setWidth(currentFrame.getRegionWidth());
    setHeight(currentFrame.getRegionHeight());
    setOrigin(getWidth() / 2, getHeight() / 2);

    collisionArea = new Rectangle(50, 0, (int)getWidth() - 100, (int)getHeight());

    health = 5;
}
 
开发者ID:broken-shotgun,项目名称:throw-the-moon,代码行数:25,代码来源:Enemy.java


示例5: AssetManager

import com.badlogic.gdx.assets.loaders.SoundLoader; //导入依赖的package包/类
/** Creates a new AssetManager with all default loaders. */
public AssetManager (FileHandleResolver resolver) {
	setLoader(BitmapFont.class, new BitmapFontLoader(resolver));
	setLoader(Music.class, new MusicLoader(resolver));
	setLoader(Pixmap.class, new PixmapLoader(resolver));
	setLoader(Sound.class, new SoundLoader(resolver));
	setLoader(TextureAtlas.class, new TextureAtlasLoader(resolver));
	setLoader(Texture.class, new TextureLoader(resolver));
	setLoader(Skin.class, new SkinLoader(resolver));
	setLoader(ParticleEffect.class, new ParticleEffectLoader(resolver));
	setLoader(PolygonRegion.class, new PolygonRegionLoader(resolver));
	setLoader(I18NBundle.class, new I18NBundleLoader(resolver));
	setLoader(Model.class, ".g3dj", new G3dModelLoader(new JsonReader(), resolver));
	setLoader(Model.class, ".g3db", new G3dModelLoader(new UBJsonReader(), resolver));
	setLoader(Model.class, ".obj", new ObjLoader(resolver));
	executor = new AsyncExecutor(1);
}
 
开发者ID:basherone,项目名称:libgdxcn,代码行数:18,代码来源:AssetManager.java


示例6: Assets

import com.badlogic.gdx.assets.loaders.SoundLoader; //导入依赖的package包/类
public Assets()
{
    textureParameter = new TextureLoader.TextureParameter();
    //textureParameter.genMipMaps = true;
    textureParameter.magFilter = Texture.TextureFilter.Linear;
    textureParameter.minFilter = Texture.TextureFilter.Linear;

    resolver = new MaryoFileHandleResolver();
    manager = new AssetManager(resolver);

    particleEffectParameter = new ParticleEffectLoader.ParticleEffectParameter();
    particleEffectParameter.imagesDir = resolver.resolve("data/animation/particles");

    // set the loaders for the generator and the fonts themselves
    manager.setLoader(FreeTypeFontGenerator.class, new FreeTypeFontGeneratorLoader(resolver));
    manager.setLoader(BitmapFont.class, ".ttf", new FreetypeFontLoader(resolver));
    manager.setLoader(ParticleEffect.class, ".p", new ParticleEffectLoader(resolver));
    manager.setLoader(Sound.class, ".mp3", new SoundLoader(new InternalFileHandleResolver()));
    manager.setLoader(Music.class, ".mp3", new MusicLoader(new InternalFileHandleResolver()));
}
 
开发者ID:pedja1,项目名称:SMC-Android,代码行数:21,代码来源:Assets.java


示例7: Player

import com.badlogic.gdx.assets.loaders.SoundLoader; //导入依赖的package包/类
public Player(final AssetManager manager) {
    manager.setLoader(Texture.class, new TextureLoader(new InternalFileHandleResolver()));
    manager.setLoader(Sound.class, new SoundLoader(new InternalFileHandleResolver()));
    manager.load(TEXTURE_FILENAME, Texture.class);
    manager.load(SFX_HIT_FILENAME, Sound.class);
    manager.load(SFX_DIE_FILENAME, Sound.class);
    manager.finishLoading();

    texture = manager.get(TEXTURE_FILENAME);
    textureRegions = TextureRegion.split(texture, FRAME_WIDTH, FRAME_HEIGHT)[0];

    idle = new Animation(0.1f, textureRegions[0], textureRegions[1], textureRegions[2]);
    idle.setPlayMode(Animation.PlayMode.LOOP);

    walk = new Animation(0.3f, textureRegions[3], textureRegions[4]);
    walk.setPlayMode(Animation.PlayMode.LOOP);

    attack = new Animation(0.3f, textureRegions[5], textureRegions[6], textureRegions[7]);
    attack.setPlayMode(Animation.PlayMode.NORMAL);

    hitSfx = manager.get(SFX_HIT_FILENAME);
    dieSfx = manager.get(SFX_DIE_FILENAME);

    setWidth(FRAME_WIDTH);
    setHeight(FRAME_HEIGHT);
    setOrigin(getWidth() / 2, getHeight() / 2);

    state = State.IDLE;
    currentFrame = idle.getKeyFrame(0.0f);

    moveTarget = new Vector2(-1, -1);
    position = new Vector2(getX(), getY());
    velocity = new Vector2(0, 0);

    collisionArea = new Rectangle(getX() + 50, getY(), (int)getWidth() - 100, (int)getHeight());
    attackArea = new Rectangle(0, 0, 0, 0);
}
 
开发者ID:broken-shotgun,项目名称:throw-the-moon,代码行数:38,代码来源:Player.java


示例8: Boss

import com.badlogic.gdx.assets.loaders.SoundLoader; //导入依赖的package包/类
public Boss(final AssetManager manager) {
    manager.setLoader(Texture.class, new TextureLoader(new InternalFileHandleResolver()));
    manager.setLoader(Sound.class, new SoundLoader(new InternalFileHandleResolver()));
    manager.load(TEXTURE_FILENAME, Texture.class);
    manager.load(SFX_HIT_FILENAME, Sound.class);
    manager.finishLoading();

    texture = manager.get(TEXTURE_FILENAME);
    regions = TextureRegion.split(texture, FRAME_WIDTH, FRAME_HEIGHT)[0];
    idle = new Animation(0.1f, regions[0], regions[1], regions[2]);
    idle.setPlayMode(Animation.PlayMode.LOOP);
    
    hitSfx = manager.get(SFX_HIT_FILENAME);

    currentFrame = idle.getKeyFrame(0.0f);

    setWidth(currentFrame.getRegionWidth());
    setHeight(currentFrame.getRegionHeight());
    setOrigin(getWidth() / 2, getHeight() / 2);

    collisionArea = new Rectangle(getX(), getY() + 80, (int) getWidth(), (int) getHeight() - 170);

    health = 50;
    raging = false;
    color = Color.WHITE;
    setColor(color);
    flipX = false;
}
 
开发者ID:broken-shotgun,项目名称:throw-the-moon,代码行数:29,代码来源:Boss.java


示例9: loadSounds

import com.badlogic.gdx.assets.loaders.SoundLoader; //导入依赖的package包/类
private void loadSounds() {
    manager.setLoader(Music.class, new MusicLoader(new InternalFileHandleResolver()));
    manager.setLoader(Sound.class, new SoundLoader(new InternalFileHandleResolver()));
    manager.load(MUSIC_FILENAME, Music.class);
    manager.load(SFX_TV_ON_FILENAME, Sound.class);
    manager.finishLoading();

    music = manager.get(MUSIC_FILENAME);
    music.setLooping(true);
    
    tvOnSfx = manager.get(SFX_TV_ON_FILENAME);
}
 
开发者ID:broken-shotgun,项目名称:throw-the-moon,代码行数:13,代码来源:GameStage.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java UrlClassLoader类代码示例发布时间:2022-05-23
下一篇:
Java ClientMetrics类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap