本文整理汇总了Java中org.newdawn.slick.Music.loop方法的典型用法代码示例。如果您正苦于以下问题:Java Music.loop方法的具体用法?Java Music.loop怎么用?Java Music.loop使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.newdawn.slick.Music
的用法示例。
在下文中一共展示了Music.loop方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: 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();
}
}
示例2: init
import org.newdawn.slick.Music; //导入方法依赖的package包/类
@Override
public void init(GameContainer container, StateBasedGame game) throws SlickException {
loadProperties();
// background = RessourceManager.loadImage("night.jpg");
connectButton = new Button(this, container, RessourceManager.loadImage("button.png"), 64, 160, () -> {
try {
SaboteurGame.instance.setUpConnection(ipTextField.getText(), 5000, pwTextField.getText(),
nameTextField.getText());
if (playMusic)
openingMenuMusic.fade(5000, 0, true);
StateManager.changeState(1, new FadeOutTransition(Color.black, 1000),
new FadeInTransition(Color.black, 1000));
} catch (Exception e) {
System.out.println("Verbindung zum Server konnte nicht hergestellt werden.");
e.printStackTrace();
}
});
connectButton.setText("Verbinden");
connectButton.setMouseDownImage(RessourceManager.loadImage("buttonShadow.png"));
exitButton =
new Button(this, container, RessourceManager.loadImage("button.png"), 1024, 512, () -> System.exit(0));
exitButton.setText("Spiel beenden");
exitButton.setSound(RessourceManager.loadSound("button.wav"));
ipTextField =
new TextField(container, new TrueTypeFont(new Font("Verdana", Font.BOLD, 16), false), 64, 64, 300, 25);
ipTextField.setTextColor(Color.black);
ipTextField.setBackgroundColor(Color.white);
ipTextField.setText("localhost");
pwTextField =
new TextField(container, new TrueTypeFont(new Font("Verdana", Font.BOLD, 16), false), 64, 96, 300, 25);
pwTextField.setTextColor(Color.black);
pwTextField.setBackgroundColor(Color.white);
pwTextField.setText("");
pwTextField.deactivate();
nameTextField =
new TextField(container, new TrueTypeFont(new Font("Verdana", Font.BOLD, 16), false), 64, 128, 300, 25);
nameTextField.setTextColor(Color.black);
nameTextField.setBackgroundColor(Color.white);
nameTextField.setText("");
nameTextField.setMaxLength(10);
if (playMusic) {
openingMenuMusic = new Music("res/music/Kool Kats.ogg");
openingMenuMusic.loop();
}
}