Gossage de musique

This commit is contained in:
MarcEricMartel 2023-12-09 16:51:43 -05:00
parent c176fddea1
commit 5b0be2d985
4 changed files with 11 additions and 7 deletions

View File

@ -302,7 +302,7 @@ void Server::Run() {
for (auto& bull : conn->Bullets) { for (auto& bull : conn->Bullets) {
bullets.emplace_back(bull); bullets.emplace_back(bull);
Log("POW!", false, false); //Log("POW!", false, false);
BulletAdd* nbul = new BulletAdd(); BulletAdd* nbul = new BulletAdd();
nbul->pos = bull->getPos(); nbul->pos = bull->getPos();
nbul->dir = bull->getVel(); nbul->dir = bull->getVel();

View File

@ -14,7 +14,7 @@ Audio::Audio(const char * music) {
m_engine->setRolloffFactor(2); m_engine->setRolloffFactor(2);
m_engine->setDefault3DSoundMinDistance(.1); m_engine->setDefault3DSoundMinDistance(.1);
m_engine->setDefault3DSoundMaxDistance(1000); 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() { Audio::~Audio() {

View File

@ -36,7 +36,7 @@ void Engine::Init() {
// Objet de skybox avec sa propre texture et son propre shader! // Objet de skybox avec sa propre texture et son propre shader!
m_skybox.Init(0.2f); m_skybox.Init(0.2f);
// Objet de musique! // Objet de musique!
m_audio.ToggleMusicState(); //m_menuaudio.ToggleMusicState();
// Array pour les balles. // Array pour les balles.
for (int x = 0; x < MAX_BULLETS; ++x) { for (int x = 0; x < MAX_BULLETS; ++x) {
@ -1236,6 +1236,8 @@ void Engine::Render(float elapsedTime) {
if (StartMultiplayerGame()) { if (StartMultiplayerGame()) {
std::cout << "Starting multiplayer game reached" << std::endl; std::cout << "Starting multiplayer game reached" << std::endl;
m_gamestate = GameState::PLAY; m_gamestate = GameState::PLAY;
//m_menuaudio.ToggleMusicState();
m_audio.ToggleMusicState();
m_startTime = std::chrono::high_resolution_clock::now(); m_startTime = std::chrono::high_resolution_clock::now();
} }
else { else {
@ -1672,7 +1674,8 @@ void Engine::KeyPressEvent(unsigned char key) {
else if (m_gamestate == GameState::PAUSE) { else if (m_gamestate == GameState::PAUSE) {
m_gamestate = GameState::PLAY; m_gamestate = GameState::PLAY;
} }
//Stop(); //m_menuaudio.ToggleMusicState();
m_audio.ToggleMusicState();
break; break;
case 57: // Space - Sauter case 57: // Space - Sauter
if (!m_keySpace) { if (!m_keySpace) {
@ -1762,7 +1765,7 @@ void Engine::KeyReleaseEvent(unsigned char key) {
m_keyL = false; m_keyL = false;
break; break;
case 12: // M - Toggle music case 12: // M - Toggle music
m_audio.ToggleMusicState(); //m_audio.ToggleMusicState();
break; break;
case 15: 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"). for (int x = 0; x < MAX_BULLETS; ++x) // Ajouter une balle dans l'array (aussi connu sous le nom de "faire pow pow").

View File

@ -86,7 +86,8 @@ private:
char SimulateKeyboard(unsigned char key); char SimulateKeyboard(unsigned char key);
void HandlePlayerInput(float elapsedTime); 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_powpow, * m_scream;
irrklang::ISound* m_whoosh[MAX_BULLETS]; irrklang::ISound* m_whoosh[MAX_BULLETS];