Search in sources :

Example 1 with Sound

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();
        }
    }
}
Also used : Music(com.badlogic.gdx.audio.Music) Sound(com.badlogic.gdx.audio.Sound)

Example 2 with Sound

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;
}
Also used : Sound(com.badlogic.gdx.audio.Sound)

Example 3 with 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();
}
Also used : Sound(com.badlogic.gdx.audio.Sound)

Example 4 with Sound

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();
}
Also used : ImageTextButton(com.badlogic.gdx.scenes.scene2d.ui.ImageTextButton) Table(com.badlogic.gdx.scenes.scene2d.ui.Table) TextArea(com.badlogic.gdx.scenes.scene2d.ui.TextArea) Sound(com.badlogic.gdx.audio.Sound) InputListener(com.badlogic.gdx.scenes.scene2d.InputListener) ScrollPane(com.badlogic.gdx.scenes.scene2d.ui.ScrollPane) NewChatMessagEvent(de.gg.event.NewChatMessagEvent) TextField(com.badlogic.gdx.scenes.scene2d.ui.TextField) NetworkHandler(de.gg.network.NetworkHandler) TextFieldListener(com.badlogic.gdx.scenes.scene2d.ui.TextField.TextFieldListener) InputEvent(com.badlogic.gdx.scenes.scene2d.InputEvent)

Example 5 with Sound

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);
}
Also used : ImageTextButton(com.badlogic.gdx.scenes.scene2d.ui.ImageTextButton) InputListener(com.badlogic.gdx.scenes.scene2d.InputListener) Sound(com.badlogic.gdx.audio.Sound) InputEvent(com.badlogic.gdx.scenes.scene2d.InputEvent) Image(com.badlogic.gdx.scenes.scene2d.ui.Image)

Aggregations

Sound (com.badlogic.gdx.audio.Sound)10 InputEvent (com.badlogic.gdx.scenes.scene2d.InputEvent)4 InputListener (com.badlogic.gdx.scenes.scene2d.InputListener)4 ImageTextButton (com.badlogic.gdx.scenes.scene2d.ui.ImageTextButton)4 Table (com.badlogic.gdx.scenes.scene2d.ui.Table)3 TextField (com.badlogic.gdx.scenes.scene2d.ui.TextField)3 Dialog (com.badlogic.gdx.scenes.scene2d.ui.Dialog)2 Image (com.badlogic.gdx.scenes.scene2d.ui.Image)2 Label (com.badlogic.gdx.scenes.scene2d.ui.Label)2 ScrollPane (com.badlogic.gdx.scenes.scene2d.ui.ScrollPane)2 Music (com.badlogic.gdx.audio.Music)1 Texture (com.badlogic.gdx.graphics.Texture)1 ButtonGroup (com.badlogic.gdx.scenes.scene2d.ui.ButtonGroup)1 CheckBox (com.badlogic.gdx.scenes.scene2d.ui.CheckBox)1 TextArea (com.badlogic.gdx.scenes.scene2d.ui.TextArea)1 TextFieldListener (com.badlogic.gdx.scenes.scene2d.ui.TextField.TextFieldListener)1 GameSessionSetup (de.gg.data.GameSessionSetup)1 GameDifficulty (de.gg.data.GameSessionSetup.GameDifficulty)1 NewChatMessagEvent (de.gg.event.NewChatMessagEvent)1 NetworkHandler (de.gg.network.NetworkHandler)1