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

Java Music类代码示例

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

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



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

示例1: init

import org.newdawn.slick.Music; //导入依赖的package包/类
/**
 * @see org.newdawn.slick.BasicGame#init(org.newdawn.slick.GameContainer)
 */
public void init(GameContainer container) throws SlickException {
	SoundStore.get().setMaxSources(32);
	
	myContainer = container;
	sound = new Sound("testdata/restart.ogg");
	charlie = new Sound("testdata/cbrown01.wav");
	try {
		engine = AudioLoader.getAudio("WAV", ResourceLoader.getResourceAsStream("testdata/engine.wav"));
	} catch (IOException e) {
		throw new SlickException("Failed to load engine", e);
	}
	music = musica = new Music("testdata/SMB-X.XM");
	//music = musica = new Music("testdata/theme.ogg", true);
	musicb = new Music("testdata/kirby.ogg", true);
	burp = new Sound("testdata/burp.aif");
	
	music.play();
}
 
开发者ID:j-dong,项目名称:trashjam2017,代码行数:22,代码来源:SoundTest.java


示例2: init

import org.newdawn.slick.Music; //导入依赖的package包/类
/**
 * @see org.newdawn.slick.BasicGame#init(org.newdawn.slick.GameContainer)
 */
public void init(GameContainer container) throws SlickException {
	LoadingList.setDeferredLoading(true);
	
	new Sound("testdata/cbrown01.wav");
	new Sound("testdata/engine.wav");
	sound = new Sound("testdata/restart.ogg");
	new Music("testdata/testloop.ogg");
	music = new Music("testdata/SMB-X.XM");
	
	new Image("testdata/cursor.png");
	new Image("testdata/cursor.tga");
	new Image("testdata/cursor.png");
	new Image("testdata/cursor.png");
	new Image("testdata/dungeontiles.gif");
	new Image("testdata/logo.gif");
	image = new Image("testdata/logo.tga");
	new Image("testdata/logo.png");
	new Image("testdata/rocket.png");
	new Image("testdata/testpack.png");
	
	font = new AngelCodeFont("testdata/demo.fnt", "testdata/demo_00.tga");
}
 
开发者ID:j-dong,项目名称:trashjam2017,代码行数:26,代码来源:DeferredLoadingTest.java


示例3: setResources

import org.newdawn.slick.Music; //导入依赖的package包/类
private void setResources() throws SlickException {
    for (Entry<Object, Object> e : mProperties.entrySet()) {
        String key = (String)e.getKey();
        String value = (String)e.getValue();
        
        if (key.startsWith("Music")) {
            DatasManager.getInstance().addFile(key,
                    new Music(ConfigsManager.getInstance().getProperties().getProperty("Resources.musicdir") + value));                
        } else if (key.startsWith("Sound")) {
            DatasManager.getInstance().addFile(key,
                    new Sound(ConfigsManager.getInstance().getProperties().getProperty("Resources.sounddir") + value));
        } else if (key.startsWith("Image")) {
            Image img = new Image(ConfigsManager.getInstance().getProperties().getProperty("Resources.imagesdir") + value);
            DatasManager.getInstance().addFile(key,
                    img);
        }
        
        Log.info("Added file to load: Key(" + key + ") Value(" + value + ")");
    }
}
 
开发者ID:AlexMog,项目名称:MMO-Rulemasters-World,代码行数:21,代码来源:ResourcesManager.java


示例4: update

import org.newdawn.slick.Music; //导入依赖的package包/类
public void update(GameContainer container, StateBasedGame game, int delta)
        throws SlickException {
	super.update(container, game, delta);
    if (mResource != null) {
        try {
            mResource.load();
        } catch (IOException e) {
            throw new SlickException("Failed to load: " + mResource.getDescription(), e);
        }
        
        mResource = null;
    }
    
    mRemaining = LoadingList.get().getRemainingResources();
    mTotal = LoadingList.get().getTotalResources();
    if (LoadingList.get().getRemainingResources() > 0) {
        mResource = LoadingList.get().getNext();
    } else {
        ((Music)DatasManager.getInstance().getFile("Music.menu")).loop();
        game.enterState(1, new FadeOutTransition(Color.black), new FadeInTransition(Color.black));
    }
}
 
开发者ID:AlexMog,项目名称:MMO-Rulemasters-World,代码行数:23,代码来源:LoadingState.java


示例5: init

import org.newdawn.slick.Music; //导入依赖的package包/类
static public  void init(){
	try {
		backgroundMusic = new Music("assets/sounds/soundeffects/bg1.ogg");
		heart = new Sound("assets/sounds/soundeffects/heart.ogg");
		backgroundMusic.loop();
		backgroundMusic.setVolume(ConfigManager.musicVolume);
		gunShot = new Sound("assets/sounds/soundeffects/gunshot.ogg");
		robotAttack = new Sound("assets/sounds/soundeffects/robotattack.ogg");
		footStep = new Sound("assets/sounds/soundeffects/footstep.ogg");
		robotPunched = new Sound("assets/sounds/soundeffects/robotpunch.ogg");
		playerPunched = new Sound("assets/sounds/soundeffects/punch.ogg");
		explosion = new Sound("assets/sounds/soundeffects/explosion.ogg");
		coin = new Sound("assets/sounds/soundeffects/coin.ogg");
	} catch (SlickException e) {
		e.printStackTrace();
	}
}
 
开发者ID:Mathgoat,项目名称:square-loot,代码行数:18,代码来源:SoundManager.java


示例6: init

import org.newdawn.slick.Music; //导入依赖的package包/类
/**
 * @see org.newdawn.slick.BasicGame#init(org.newdawn.slick.GameContainer)
 */
public void init(GameContainer container) throws SlickException {
	sound = new Sound(ResourceLoader.getResource("testdata/restart.ogg"));
	charlie = new Sound(ResourceLoader.getResource("testdata/cbrown01.wav"));
	engine = new Sound(ResourceLoader.getResource("testdata/engine.wav"));
	//music = musica = new Music("testdata/SMB-X.XM");
	music = musica = new Music(ResourceLoader.getResource("testdata/restart.ogg"), false);
	musicb = new Music(ResourceLoader.getResource("testdata/kirby.ogg"), false);
	burp = new Sound(ResourceLoader.getResource("testdata/burp.aif"));
}
 
开发者ID:j-dong,项目名称:trashjam2017,代码行数:13,代码来源:SoundURLTest.java


示例7: init

import org.newdawn.slick.Music; //导入依赖的package包/类
/**
 * @see org.newdawn.slick.BasicGame#init(org.newdawn.slick.GameContainer)
 */
public void init(GameContainer container) throws SlickException {
	SoundStore.get().setMaxSources(32);
	
	myContainer = container;
	music = new Music("testdata/kirby.ogg", true);
	music.play();
}
 
开发者ID:j-dong,项目名称:trashjam2017,代码行数:11,代码来源:SoundPositionTest.java


示例8: init

import org.newdawn.slick.Music; //导入依赖的package包/类
/**
 * @see org.newdawn.slick.BasicGame#init(org.newdawn.slick.GameContainer)
 */
public void init(GameContainer container) throws SlickException {
	music = new Music("testdata/restart.ogg", false);
	stream = new Music("testdata/restart.ogg", false);
	
	music.addListener(this);
	stream.addListener(this);
}
 
开发者ID:j-dong,项目名称:trashjam2017,代码行数:11,代码来源:MusicListenerTest.java


示例9: init

import org.newdawn.slick.Music; //导入依赖的package包/类
@Override
public void init(GameContainer gc, StateBasedGame sbg) throws SlickException {
    credits = new Music("res/credits.ogg");
    endTime = 0.0;
    for (CreditLine line : creditLines) {
        if (line.end > endTime)
            endTime = line.end;
    }
}
 
开发者ID:j-dong,项目名称:trashjam2017,代码行数:10,代码来源:Credits.java


示例10: init

import org.newdawn.slick.Music; //导入依赖的package包/类
@Override
public void init(GameContainer gc, StateBasedGame sbg) throws SlickException {
    mainMenu = new Music("res/menu.ogg");
    click = new Sound("res/menuclick.ogg");
    title = new Image("res/title.png");
    title.setFilter(Image.FILTER_NEAREST);
}
 
开发者ID:j-dong,项目名称:trashjam2017,代码行数:8,代码来源:MainMenu.java


示例11: nextSong

import org.newdawn.slick.Music; //导入依赖的package包/类
public void nextSong() throws SlickException {
	currentSong++;
	if(currentSong > SOUNDTRACK_LENGTH) currentSong = 1; 
	
	String songName = String.format("soundtrack_%02d", currentSong);
	Music song = new Music(String.format("music/%s.ogg", songName));
	if(song != null) {
		nowPlaying = song;
		nowPlaying.play();
	}
	
	System.out.println("Playing next song: " + songName);
}
 
开发者ID:packetpirate,项目名称:Generic-Zombie-Shooter-Redux,代码行数:14,代码来源:MusicPlayer.java


示例12: instanciation

import org.newdawn.slick.Music; //导入依赖的package包/类
@Override
   public void instanciation() throws SlickException {
// ID for the next state (0 is main menu, ID+1 is the next level)

player = new Player(2 * 70, 2 * 70);

// Remplis ennemis
ennemies.add(new SpinnerHalf(7 * 70, 4 * 70));
ennemies.add(new SpinnerHalf(9 * 70, 4 * 70));
ennemies.add(new Spider(34 * 70, 18 * 70));
ennemies.add(new SnakeLava(37 * 70, 16 * 70));
ennemies.add(new VoidFlyer(34 * 70, 2 * 70));
ennemies.add(new VoidFlyer(42 * 70, 6 * 70));
ennemies.add(new Ghost(19 * 70, 1 * 70));

// Remplis Objectifs
objectives.add(new Coin(1 * 70, 16 * 70));
objectives.add(new Coin(42 * 70, 3 * 70));
objectives.add(new Coin(17 * 70, 15 * 70));
objectives.add(new Coin(16 * 70, 6 * 70));
objectives.add(new Key(18 * 70, 3 * 70));

// setup music (si rien, on garde la m�me musique qu'au niveau d'avant)
musiclvl = new Music("ressources/audio/music/lvl5.ogg");

player.setWeapon(1);

initialisationSuite();

   }
 
开发者ID:maloz,项目名称:p2_java_plateformed2d,代码行数:31,代码来源:Level5.java


示例13: instanciation

import org.newdawn.slick.Music; //导入依赖的package包/类
@Override
   public void instanciation() throws SlickException {
// ID for the next state (0 is main menu, ID+1 is the next level)

player = new Player(2 * 70, 14 * 70);

// Remplis ennemis
ennemies.add(new Abeille(16 * 70, 1 * 70));
ennemies.add(new Abeille(42 * 70, 2 * 70));
ennemies.add(new SnakeLava(9 * 70, 14 * 70));
ennemies.add(new SnakeLava(13 * 70, 14 * 70));
ennemies.add(new SnakeLava(17 * 70, 14 * 70));
ennemies.add(new SpinnerHalf(17 * 70, 5 * 70));
ennemies.add(new SpinnerHalf(20 * 70, 5 * 70));

// Remplis Objectifs
objectives.add(new Coin(17 * 70, 10 * 70));
objectives.add(new Coin(1 * 70, 8 * 70));
objectives.add(new Coin(36 * 70, 4 * 70));
objectives.add(new Coin(18 * 70, 4 * 70));
objectives.add(new Key(36 * 70, 11 * 70));

// setup music (si rien, on garde la m�me musique qu'au niveau d'avant)
musiclvl = new Music("ressources/audio/music/lvl2.ogg");

player.setWeapon(2);

initialisationSuite();

level.setBackground(new Image("ressources/background/moutain.png"));

   }
 
开发者ID:maloz,项目名称:p2_java_plateformed2d,代码行数:33,代码来源:Level2.java


示例14: instanciation

import org.newdawn.slick.Music; //导入依赖的package包/类
@Override
   public void instanciation() throws SlickException {
// ID for the next state (0 is main menu, ID+1 is the next level)

player = new Player(3 * 70, 15 * 70);

// Remplis ennemis
ennemies.add(new Ghost(16 * 70, 13 * 70));
ennemies.add(new Ghost(10 * 70, 9 * 70));
ennemies.add(new VoidFlyer(38 * 70, 15 * 70));
ennemies.add(new VoidFlyer(42 * 70, 9 * 70));
ennemies.add(new VoidFlyer(12 * 70, 2 * 70));
ennemies.add(new VoidFlyer(33 * 70, 5 * 70));
ennemies.add(new Spider(34 * 70, 18 * 70));

// Remplis Objectifs
objectives.add(new Coin(1 * 70, 16 * 70));
objectives.add(new Coin(39 * 70, 16 * 70));
objectives.add(new Coin(35 * 70, 7 * 70));
objectives.add(new Coin(48 * 70, 8 * 70));
objectives.add(new Key(41 * 70, 11 * 70));

// setup music (si rien, on garde la m�me musique qu'au niveau d'avant)
musiclvl = new Music("ressources/audio/music/lvl4.ogg");

player.setWeapon(0);

initialisationSuite();

level.setBackground(new Image("ressources/background/forest.png"));

   }
 
开发者ID:maloz,项目名称:p2_java_plateformed2d,代码行数:33,代码来源:Level4.java


示例15: instanciation

import org.newdawn.slick.Music; //导入依赖的package包/类
@Override
   public void instanciation() throws SlickException {
// at the start of the game we don't have a player yet
player = new Player(1 * 70, 16 * 70);

// Remplis ennmis
ennemies.add(new Abeille(5 * 70, 6 * 70));
ennemies.add(new Abeille(26 * 70, 9 * 70));
ennemies.add(new Abeille(38 * 70, 9 * 70));
ennemies.add(new Spider(31 * 70, 17 * 70));
ennemies.add(new SnakeLava(15 * 70, 14 * 70));

// Remplis Objectifs
objectives.add(new Coin(8 * 70, 6 * 70));
objectives.add(new Coin(23 * 70, 5 * 70));
objectives.add(new Coin(37 * 70, 10 * 70));
objectives.add(new Coin(35 * 70, 17 * 70));
objectives.add(new Key(6 * 70, 7 * 70));

// setup music
musiclvl = new Music("ressources/audio/music/lvl1.ogg");

// set weapon
player.setWeapon(0);

// instanciation du level etc
initialisationSuite();

// choix du background
level.setBackground(new Image("ressources/background/desert.png"));
   }
 
开发者ID:maloz,项目名称:p2_java_plateformed2d,代码行数:32,代码来源:Level1.java


示例16: instanciation

import org.newdawn.slick.Music; //导入依赖的package包/类
@Override
   public void instanciation() throws SlickException {
// ID for the next state (0 is main menu, ID+1 is the next level)

player = new Player(1 * 70, 16 * 70);

// Remplis ennemis
ennemies.add(new Bat(7 * 70, 3 * 70));
ennemies.add(new Bat(2 * 70, 7 * 70));
ennemies.add(new Bat(26 * 70, 2 * 70));
ennemies.add(new Spider(15 * 70, 17 * 70));
ennemies.add(new SnakeLava(7 * 70, 16 * 70));
ennemies.add(new SpinnerHalf(10 * 70, 18 * 70));

// Remplis Objectifs
objectives.add(new Coin(25 * 70, 2 * 70));
objectives.add(new Coin(2 * 70, 10 * 70));
objectives.add(new Coin(47 * 70, 6 * 70));
objectives.add(new Coin(36 * 70, 14 * 70));
objectives.add(new Key(43 * 70, 2 * 70));

// setup music (si rien, on garde la m�me musique qu'au niveau d'avant)
musiclvl = new Music("ressources/audio/music/lvl3.ogg");

player.setWeapon(1);
initialisationSuite();

level.setBackground(new Image("ressources/background/land.png"));
   }
 
开发者ID:maloz,项目名称:p2_java_plateformed2d,代码行数:30,代码来源:Level3.java


示例17: instanciation

import org.newdawn.slick.Music; //导入依赖的package包/类
@Override
   public void instanciation() throws SlickException {
// ID for the next state (0 is main menu, ID+1 is the next level)

player = new Player(2 * 70, 22 * 70);

// Remplis ennemis
ennemies.add(new Bat(3 * 70, 15 * 70));
ennemies.add(new Ghost(10 * 70, 12 * 70));
ennemies.add(new Bat(15 * 70, 10 * 70));
ennemies.add(new Ghost(31 * 70, 13 * 70));
ennemies.add(new Bat(46 * 70, 14 * 70));
ennemies.add(new Ghost(56 * 70, 6 * 70));
ennemies.add(new Bat(44 * 70, 3 * 70));
ennemies.add(new Ghost(21 * 70, 3 * 70));
ennemies.add(new Bat(4 * 70, 8 * 70));
ennemies.add(new Spider(20 * 70, 23 * 70));
ennemies.add(new Spider(30 * 70, 23 * 70));
ennemies.add(new Spider(40 * 70, 23 * 70));
ennemies.add(new Spider(50 * 70, 23 * 70));

// Remplis Objectifs
objectives.add(new Coin(12 * 70, 20 * 70));
objectives.add(new Coin(31 * 70, 16 * 70));
objectives.add(new Coin(54 * 70, 11 * 70));
objectives.add(new Coin(29 * 70, 4 * 70));
objectives.add(new Key(15 * 70, 22 * 70));

// setup music (si rien, on garde la m�me musique qu'au niveau d'avant)
musiclvl = new Music("ressources/audio/music/lvl6.ogg");

player.setWeapon(2);

initialisationSuite();

   }
 
开发者ID:maloz,项目名称:p2_java_plateformed2d,代码行数:37,代码来源:Level6.java


示例18: init

import org.newdawn.slick.Music; //导入依赖的package包/类
@Override
   public void init(GameContainer container, StateBasedGame game) throws SlickException {
// Background image
background = new Image("ressources/background/background.jpg");

// Music
deadMusic = new Music("ressources/audio/music/gameover.ogg");

// Sound
rollover = new Sound("ressources/audio/sound/rollover.ogg");

// Cursor image
cursor = new Image("ressources/cursor/hand_cursor.png");

// Color for button when mous is over
Color color = new Color(255, 157, 67, 180);

// Button "Quitter"
Image quitterImage = new Image("ressources/menu/quitter.png");

quitter = new SlickButton(container, quitterImage,
	WindowGame.BASE_WINDOW_WIDTH / 2 - quitterImage.getWidth() / 2, 500, quitterImage.getWidth(),
	quitterImage.getHeight(), new ComponentListener() {

	    @Override
	    public void componentActivated(AbstractComponent arg0) {
		game.enterState(0);
	    }
	});

quitter.setMouseOverColor(color);
quitter.setMouseDownSound(rollover);
   }
 
开发者ID:maloz,项目名称:p2_java_plateformed2d,代码行数:34,代码来源:GameOver.java


示例19: init

import org.newdawn.slick.Music; //导入依赖的package包/类
@Override
public void init() {
	timer = 0;

	tilemap = new TileMap();

	Entity.removeAll();
	Animation.removeAll();

	new Player(GamePanel.WIDTH / 2 - 4, GamePanel.HEIGHT / 2 - 4);

	Stage.transitionStage();

	if (!fadein) {
		new FadeIn().start();
		fadein = true;
	}

	try {
		music_game = new Music(GamePanel.resfolder + "sound" + File.separator + "game.wav");
		music_boss = new Music(GamePanel.resfolder + "sound" + File.separator + "bosstheme.wav");
	} catch (SlickException e) {
		e.printStackTrace();
	}

	music_game.play(1f, GamePanel.MUSIC_VOLUME);

	deadTimer = 60;

	Map.difficulty = 0;
	Generator.generate();
}
 
开发者ID:Timbals,项目名称:YellowSquare,代码行数:33,代码来源:SinglePlayerState.java


示例20: init

import org.newdawn.slick.Music; //导入依赖的package包/类
public static void init() throws SlickException {
    if (needInit == true) {
        musics = new HashMap<>();
        musics.put(EnumSound.BACKGROUND, new Music(EnumSound.BACKGROUND.getPath()));
        musics.put(EnumSound.SELECT, new Music(EnumSound.SELECT.getPath()));
        pitch = 1.0f;
        volume = 1.0f;
        maxVolume = 2.0f;
        needInit = false;
    }
}
 
开发者ID:LeNiglo,项目名称:TinyTank,代码行数:12,代码来源:MusicController.java



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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