use of com.badlogic.gdx.audio.Sound in project Catacomb-Snatch by Catacomb-Snatch.
the class GdxSoundPlayer method shutdown.
@Override
public void shutdown() {
Music music;
// unloading Title music
stopTitleMusic();
music = getMusic(Sounds.TITLE_THEME);
if (music != null) {
music.dispose();
}
// unloading End music
stopEndMusic();
music = getMusic(Sounds.END_THEME);
if (music != null) {
music.dispose();
}
// unloading Background music
stopBackgroundMusic();
for (Music m : backgroundMusicList) {
if (m.isPlaying())
m.stop();
m.dispose();
}
// unloading sounds
if (soundsMap.size > 0) {
for (Sound s : soundsMap.values()) {
s.stop();
s.dispose();
}
}
}
use of com.badlogic.gdx.audio.Sound in project libgdx by libgdx.
the class SoundLoader method loadSync.
@Override
public Sound loadSync(AssetManager manager, String fileName, FileHandle file, SoundParameter parameter) {
Sound sound = this.sound;
this.sound = null;
return sound;
}
use of com.badlogic.gdx.audio.Sound in project netthreads-libgdx by alistairrutherford.
the class SoundCache method dispose.
/**
* Dispose of cache data.
*
*/
@Override
public void dispose() {
Collection<Sound> values = data.values();
for (Sound sound : values) {
sound.dispose();
}
data.clear();
definitions.clear();
}
use of com.badlogic.gdx.audio.Sound in project ProjektGG by eskalon.
the class LobbyScreen method initUI.
@Override
protected void initUI() {
// backgroundTexture = assetManager.get(BACKGROUND_IMAGE_PATH);
Sound clickSound = assetManager.get(BUTTON_SOUND);
// mainTable.setBackground(skin.getDrawable("parchment-small"));
ImageTextButton leaveButton = new ImageTextButton("Verlassen", skin);
leaveButton.addListener(new InputListener() {
public boolean touchDown(InputEvent event, float x, float y, int pointer, int button) {
clickSound.play(1F);
game.getNetworkHandler().disconnect();
game.pushScreen("mainMenu");
return true;
}
});
NetworkHandler netHandler = game.getNetworkHandler();
readyUpLobbyButton = new ImageTextButton("Bereit", skin);
if (netHandler.isHost()) {
readyUpLobbyButton.setDisabled(true);
readyUpLobbyButton.setText("Spiel starten");
}
readyUpLobbyButton.addListener(new InputListener() {
public boolean touchDown(InputEvent event, float x, float y, int pointer, int button) {
clickSound.play(1F);
getLocalPlayer().toggleReady();
netHandler.onLocalPlayerChange(getLocalPlayer());
updateLobbyUI();
return true;
}
});
Table playerTable = new Table();
Table settingsTable = new Table();
Table buttonTable = new Table();
Table chatTable = new Table();
// settings table + player table
buttonTable.add(readyUpLobbyButton).bottom().padBottom(20).row();
buttonTable.add(leaveButton);
Table chatInputTable = new Table();
ImageTextButton sendButton = new ImageTextButton("Senden", skin);
TextField chatInputField = new TextField("", skin);
chatInputField.setTextFieldListener(new TextFieldListener() {
@Override
public void keyTyped(TextField textField, char key) {
if (!textField.getText().isEmpty() && (key == (char) 13)) {
// Enter
clickSound.play(1F);
netHandler.sendChatMessage(chatInputField.getText());
onNewChatMessage(new NewChatMessagEvent(localNetworkId, chatInputField.getText()));
chatInputField.setText("");
}
}
});
sendButton.addListener(new InputListener() {
public boolean touchDown(InputEvent event, float x, float y, int pointer, int button) {
if (!chatInputField.getText().isEmpty()) {
clickSound.play(1F);
netHandler.sendChatMessage(chatInputField.getText());
onNewChatMessage(new NewChatMessagEvent(localNetworkId, chatInputField.getText()));
chatInputField.setText("");
}
return true;
}
});
messagesArea = new TextArea("", skin);
messagesArea.setDisabled(true);
ScrollPane messagesPane = new ScrollPane(messagesArea);
chatInputTable.add(chatInputField).left().width(325).padRight(15);
chatInputTable.add(sendButton);
chatTable.debug();
chatTable.add(messagesPane).height(125).width(425).top().row();
chatTable.add(chatInputTable).left().padTop(10).width(425).bottom();
playerSlots = new Table[6];
playerSlots[0] = new Table();
playerSlots[1] = new Table();
playerSlots[2] = new Table();
playerSlots[3] = new Table();
playerSlots[4] = new Table();
playerSlots[5] = new Table();
playerTable.add(playerSlots[0]).height(25).width(425).row();
playerTable.add(playerSlots[1]).height(25).width(425).row();
playerTable.add(playerSlots[2]).height(25).width(425).row();
playerTable.add(playerSlots[3]).height(25).width(425).row();
playerTable.add(playerSlots[4]).height(25).width(425).row();
playerTable.add(playerSlots[5]).height(25).width(425).row();
mainTable.add(playerTable).width(425).height(155);
mainTable.add(settingsTable).width(155).row();
mainTable.add(chatTable).height(165).bottom();
mainTable.add(buttonTable).height(165);
mainTable.setDebug(true);
// updateLobbyUI();
}
use of com.badlogic.gdx.audio.Sound in project ProjektGG by eskalon.
the class MainMenuScreen method initUI.
@Override
protected void initUI() {
backgroundTexture = assetManager.get(BACKGROUND_IMAGE_PATH);
Sound clickSound = assetManager.get(BUTTON_SOUND);
ImageTextButton multiplayerButton = new ImageTextButton("Multiplayer", skin);
multiplayerButton.addListener(new InputListener() {
public boolean touchDown(InputEvent event, float x, float y, int pointer, int button) {
clickSound.play(1F);
game.pushScreen("serverBrowser");
return true;
}
});
ImageTextButton settingsButton = new ImageTextButton("Einstellungen", skin);
settingsButton.addListener(new InputListener() {
public boolean touchDown(InputEvent event, float x, float y, int pointer, int button) {
clickSound.play(1F);
// Gdx.app.exit();
return true;
}
});
ImageTextButton exitButton = new ImageTextButton("Beenden", skin);
exitButton.addListener(new InputListener() {
public boolean touchDown(InputEvent event, float x, float y, int pointer, int button) {
clickSound.play(1F);
Gdx.app.exit();
return true;
}
});
Image logoImage = new Image((Texture) assetManager.get(LOGO_IMAGE_PATH));
/*
* multiplayerButton .addListener(new TextTooltip("You can press this",
* skin));
*/
mainTable.add(logoImage).padBottom(25f).padTop(-120f);
mainTable.row();
mainTable.add(multiplayerButton).padBottom(11f);
mainTable.row();
mainTable.add(settingsButton).padBottom(11f);
mainTable.row();
mainTable.add(exitButton);
}
Aggregations