From 5b0be2d98535e4a2e601b6364b8ea80774703651 Mon Sep 17 00:00:00 2001 From: MarcEricMartel Date: Sat, 9 Dec 2023 16:51:43 -0500 Subject: [PATCH] Gossage de musique --- SQCSim-srv/server.cpp | 2 +- SQCSim2021/audio.cpp | 2 +- SQCSim2021/engine.cpp | 11 +++++++---- SQCSim2021/engine.h | 3 ++- 4 files changed, 11 insertions(+), 7 deletions(-) diff --git a/SQCSim-srv/server.cpp b/SQCSim-srv/server.cpp index 2bd43eb..edf740c 100644 --- a/SQCSim-srv/server.cpp +++ b/SQCSim-srv/server.cpp @@ -302,7 +302,7 @@ void Server::Run() { for (auto& bull : conn->Bullets) { bullets.emplace_back(bull); - Log("POW!", false, false); + //Log("POW!", false, false); BulletAdd* nbul = new BulletAdd(); nbul->pos = bull->getPos(); nbul->dir = bull->getVel(); diff --git a/SQCSim2021/audio.cpp b/SQCSim2021/audio.cpp index 7691f88..fda7368 100644 --- a/SQCSim2021/audio.cpp +++ b/SQCSim2021/audio.cpp @@ -14,7 +14,7 @@ Audio::Audio(const char * music) { m_engine->setRolloffFactor(2); m_engine->setDefault3DSoundMinDistance(.1); m_engine->setDefault3DSoundMaxDistance(1000); - m_music = m_engine->play2D(music, false, true, true, irrklang::ESM_STREAMING); + m_music = m_engine->play2D(music, true, true, true, irrklang::ESM_STREAMING); } Audio::~Audio() { diff --git a/SQCSim2021/engine.cpp b/SQCSim2021/engine.cpp index 43c1deb..bf78ee5 100644 --- a/SQCSim2021/engine.cpp +++ b/SQCSim2021/engine.cpp @@ -36,8 +36,8 @@ void Engine::Init() { // Objet de skybox avec sa propre texture et son propre shader! m_skybox.Init(0.2f); // Objet de musique! - m_audio.ToggleMusicState(); - + //m_menuaudio.ToggleMusicState(); + // Array pour les balles. for (int x = 0; x < MAX_BULLETS; ++x) { m_bullets[x] = nullptr; @@ -1236,6 +1236,8 @@ void Engine::Render(float elapsedTime) { if (StartMultiplayerGame()) { std::cout << "Starting multiplayer game reached" << std::endl; m_gamestate = GameState::PLAY; + //m_menuaudio.ToggleMusicState(); + m_audio.ToggleMusicState(); m_startTime = std::chrono::high_resolution_clock::now(); } else { @@ -1672,7 +1674,8 @@ void Engine::KeyPressEvent(unsigned char key) { else if (m_gamestate == GameState::PAUSE) { m_gamestate = GameState::PLAY; } - //Stop(); + //m_menuaudio.ToggleMusicState(); + m_audio.ToggleMusicState(); break; case 57: // Space - Sauter if (!m_keySpace) { @@ -1762,7 +1765,7 @@ void Engine::KeyReleaseEvent(unsigned char key) { m_keyL = false; break; case 12: // M - Toggle music - m_audio.ToggleMusicState(); + //m_audio.ToggleMusicState(); break; case 15: for (int x = 0; x < MAX_BULLETS; ++x) // Ajouter une balle dans l'array (aussi connu sous le nom de "faire pow pow"). diff --git a/SQCSim2021/engine.h b/SQCSim2021/engine.h index 69635a6..8ca3894 100644 --- a/SQCSim2021/engine.h +++ b/SQCSim2021/engine.h @@ -86,7 +86,8 @@ private: char SimulateKeyboard(unsigned char key); void HandlePlayerInput(float elapsedTime); - Audio m_audio = Audio(AUDIO_PATH "start.wav"); + //udio m_menuaudio = Audio(AUDIO_PATH "menumusic.wav"); + Audio m_audio = Audio(AUDIO_PATH "music01.wav"); irrklang::ISound* m_powpow, * m_scream; irrklang::ISound* m_whoosh[MAX_BULLETS];