本文整理汇总了Java中org.newdawn.slick.Music类的典型用法代码示例。如果您正苦于以下问题:Java Music类的具体用法?Java Music怎么用?Java Music使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Music类属于org.newdawn.slick包,在下文中一共展示了Music类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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();
}
示例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");
}
示例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 + ")");
}
}
示例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));
}
}
示例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();
}
}
示例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"));
}
示例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();
}
示例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);
}
示例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;
}
}
示例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);
}
示例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);
}
示例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();
}
示例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"));
}
示例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"));
}
示例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"));
}