当前位置: 首页>>代码示例>>Java>>正文


Java Music.loop方法代码示例

本文整理汇总了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();
	}
}
 
开发者ID:Mathgoat,项目名称:square-loot,代码行数:18,代码来源:SoundManager.java

示例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();
	}
}
 
开发者ID:JavaJumperStudios,项目名称:Saboteur,代码行数:54,代码来源:SaboteurMenu.java


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