This commit is contained in:
serk 2017-01-22 05:08:12 +01:00
commit 0a589d6a11
87 changed files with 77 additions and 38 deletions

BIN
Resources/Sounds/Bona/1.ogg Normal file

Binary file not shown.

BIN
Resources/Sounds/Bona/2.ogg Normal file

Binary file not shown.

BIN
Resources/Sounds/Bona/3.ogg Normal file

Binary file not shown.

BIN
Resources/Sounds/Bona/4.ogg Normal file

Binary file not shown.

BIN
Resources/Sounds/Bona/5.ogg Normal file

Binary file not shown.

BIN
Resources/Sounds/Bona/6.ogg Normal file

Binary file not shown.

BIN
Resources/Sounds/Bona/7.ogg Normal file

Binary file not shown.

BIN
Resources/Sounds/Bona/8.ogg Normal file

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
Resources/Sounds/clicks.ogg Normal file

Binary file not shown.

Binary file not shown.

BIN
Resources/Sounds/intro.ogg Normal file

Binary file not shown.

Binary file not shown.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3 KiB

After

Width:  |  Height:  |  Size: 3.2 KiB

BIN
Resources/portada.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 219 KiB

BIN
Resources/portada.xcf Normal file

Binary file not shown.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.9 KiB

After

Width:  |  Height:  |  Size: 2.9 KiB

View file

@ -51,23 +51,30 @@ void Character::setState(PlayerState::playerState state){
indexX = 0;
indexY = 1 + magicNumber;
std::string sample = "atk"+std::to_string(rand()%20+1);
SoundManager::setVolume(100,sample);
SoundManager::playSound(sample);
//std::cout << "playing sample " << sample << std::endl;
}
else if (state == PlayerState::hurt){
std::cout << "i am hurt" << std::endl;
//std::cout << "i am hurt" << std::endl;
indexX = 0;
indexY = 2 + magicNumber;
std::string sample = "fail"+std::to_string(rand()%6+1);
SoundManager::setVolume(100,sample);
SoundManager::playSound(sample);
//std::cout << "playing sample " << sample << std::endl;
}
else if (state == PlayerState::success){
std::cout << "i am succeed!" << std::endl;
//std::cout << "i am succeed!" << std::endl;
indexX = 0;
indexY = 3 + magicNumber;
//std::string sample = "succeed"+std::to_string(rand()%6+1);
//SoundManager::playSound(sample);
std::string sample = "bona"+std::to_string(rand()%8+1);
SoundManager::setVolume(10,sample);
SoundManager::playSound(sample);
std::cout << "playing sample " << sample << std::endl;
}
}

View file

@ -13,7 +13,7 @@
#include <string>
#include "soundmanager.hpp"
const int SCENE_NUM = 4;
#define MARGEERR 0.2f
#define MARGEERR 0.25f
#define BLACKVALUE 0.4f
#define W_WIDTH 1024
#define W_HEIGHT 768

View file

@ -10,7 +10,6 @@ MyGame::MyGame() {
_scenes[GameScene::credits] = _menu;
std::cout << "in menu" << std::endl;
SoundManager::load();
SoundManager::setGlobalSoundVolumen(50);
SoundManager::setLoop(true, "intro");
SoundManager::playMusic("intro");
}

View file

@ -26,6 +26,7 @@ bool Player::event(sf::Event e) {
case (sf::Event::KeyPressed):
if(e.key.code == sf::Keyboard::C) {
std::string sample = "note"+std::to_string(rand()%4+1);
SoundManager::playSound(sample);
std::cout << "playing sample " << sample << std::endl;
compas.start();

View file

@ -39,6 +39,14 @@ sf::SoundBuffer SoundManager::note1;
sf::SoundBuffer SoundManager::note2;
sf::SoundBuffer SoundManager::note3;
sf::SoundBuffer SoundManager::note4;
sf::SoundBuffer SoundManager::bona1;
sf::SoundBuffer SoundManager::bona2;
sf::SoundBuffer SoundManager::bona3;
sf::SoundBuffer SoundManager::bona4;
sf::SoundBuffer SoundManager::bona5;
sf::SoundBuffer SoundManager::bona6;
sf::SoundBuffer SoundManager::bona7;
sf::SoundBuffer SoundManager::bona8;
std::map<std::string, sf::Sound> SoundManager::soundMap;
std::map<std::string, sf::Music> SoundManager::musicMap;
@ -50,68 +58,84 @@ void SoundManager::load(){
//LOAD HERE YOUR SOUNDS AND MUSIC
/* Example: */
musicMap["intro"].openFromFile(WORK_DIR+"Resources/Sounds/intro.wav");
musicMap["clicks"].openFromFile(WORK_DIR+"Resources/Sounds/clicks.wav");
ASSERT(atk1.loadFromFile(WORK_DIR+"Resources/Sounds/Samples/1.wav"));
musicMap["intro"].openFromFile(WORK_DIR+"Resources/Sounds/intro.ogg");
musicMap["clicks"].openFromFile(WORK_DIR+"Resources/Sounds/clicks.ogg");
ASSERT(atk1.loadFromFile(WORK_DIR+"Resources/Sounds/Samples/1.ogg"));
soundMap["atk1"].setBuffer(atk1);
ASSERT(atk2.loadFromFile(WORK_DIR+"Resources/Sounds/Samples/2.wav"));
ASSERT(atk2.loadFromFile(WORK_DIR+"Resources/Sounds/Samples/2.ogg"));
soundMap["atk2"].setBuffer(atk2);
ASSERT(atk3.loadFromFile(WORK_DIR+"Resources/Sounds/Samples/3.wav"));
ASSERT(atk3.loadFromFile(WORK_DIR+"Resources/Sounds/Samples/3.ogg"));
soundMap["atk3"].setBuffer(atk3);
ASSERT(atk4.loadFromFile(WORK_DIR+"Resources/Sounds/Samples/4.wav"));
ASSERT(atk4.loadFromFile(WORK_DIR+"Resources/Sounds/Samples/4.ogg"));
soundMap["atk4"].setBuffer(atk4);
ASSERT(atk5.loadFromFile(WORK_DIR+"Resources/Sounds/Samples/5.wav"));
ASSERT(atk5.loadFromFile(WORK_DIR+"Resources/Sounds/Samples/5.ogg"));
soundMap["atk5"].setBuffer(atk5);
ASSERT(atk6.loadFromFile(WORK_DIR+"Resources/Sounds/Samples/6.wav"));
ASSERT(atk6.loadFromFile(WORK_DIR+"Resources/Sounds/Samples/6.ogg"));
soundMap["atk6"].setBuffer(atk6);
ASSERT(atk7.loadFromFile(WORK_DIR+"Resources/Sounds/Samples/7.wav"));
ASSERT(atk7.loadFromFile(WORK_DIR+"Resources/Sounds/Samples/7.ogg"));
soundMap["atk7"].setBuffer(atk7);
ASSERT(atk8.loadFromFile(WORK_DIR+"Resources/Sounds/Samples/8.wav"));
ASSERT(atk8.loadFromFile(WORK_DIR+"Resources/Sounds/Samples/8.ogg"));
soundMap["atk8"].setBuffer(atk8);
ASSERT(atk9.loadFromFile(WORK_DIR+"Resources/Sounds/Samples/9.wav"));
ASSERT(atk9.loadFromFile(WORK_DIR+"Resources/Sounds/Samples/9.ogg"));
soundMap["atk9"].setBuffer(atk9);
ASSERT(atk10.loadFromFile(WORK_DIR+"Resources/Sounds/Samples/10.wav"));
ASSERT(atk10.loadFromFile(WORK_DIR+"Resources/Sounds/Samples/10.ogg"));
soundMap["atk10"].setBuffer(atk10);
ASSERT(atk11.loadFromFile(WORK_DIR+"Resources/Sounds/Samples/11.wav"));
ASSERT(atk11.loadFromFile(WORK_DIR+"Resources/Sounds/Samples/11.ogg"));
soundMap["atk11"].setBuffer(atk11);
ASSERT(atk12.loadFromFile(WORK_DIR+"Resources/Sounds/Samples/12.wav"));
ASSERT(atk12.loadFromFile(WORK_DIR+"Resources/Sounds/Samples/12.ogg"));
soundMap["atk12"].setBuffer(atk12);
ASSERT(atk13.loadFromFile(WORK_DIR+"Resources/Sounds/Samples/13.wav"));
ASSERT(atk13.loadFromFile(WORK_DIR+"Resources/Sounds/Samples/13.ogg"));
soundMap["atk13"].setBuffer(atk13);
ASSERT(atk14.loadFromFile(WORK_DIR+"Resources/Sounds/Samples/14.wav"));
ASSERT(atk14.loadFromFile(WORK_DIR+"Resources/Sounds/Samples/14.ogg"));
soundMap["atk14"].setBuffer(atk14);
ASSERT(atk15.loadFromFile(WORK_DIR+"Resources/Sounds/Samples/15.wav"));
ASSERT(atk15.loadFromFile(WORK_DIR+"Resources/Sounds/Samples/15.ogg"));
soundMap["atk15"].setBuffer(atk15);
ASSERT(atk16.loadFromFile(WORK_DIR+"Resources/Sounds/Samples/16.wav"));
ASSERT(atk16.loadFromFile(WORK_DIR+"Resources/Sounds/Samples/16.ogg"));
soundMap["atk16"].setBuffer(atk16);
ASSERT(atk17.loadFromFile(WORK_DIR+"Resources/Sounds/Samples/17.wav"));
ASSERT(atk17.loadFromFile(WORK_DIR+"Resources/Sounds/Samples/17.ogg"));
soundMap["atk17"].setBuffer(atk17);
ASSERT(atk18.loadFromFile(WORK_DIR+"Resources/Sounds/Samples/18.wav"));
ASSERT(atk18.loadFromFile(WORK_DIR+"Resources/Sounds/Samples/18.ogg"));
soundMap["atk18"].setBuffer(atk18);
ASSERT(atk19.loadFromFile(WORK_DIR+"Resources/Sounds/Samples/19.wav"));
ASSERT(atk19.loadFromFile(WORK_DIR+"Resources/Sounds/Samples/19.ogg"));
soundMap["atk19"].setBuffer(atk19);
ASSERT(atk20.loadFromFile(WORK_DIR+"Resources/Sounds/Samples/20.wav"));
ASSERT(atk20.loadFromFile(WORK_DIR+"Resources/Sounds/Samples/20.ogg"));
soundMap["atk20"].setBuffer(atk20);
ASSERT(fail1.loadFromFile(WORK_DIR+"Resources/Sounds/Fails/1.wav"));
ASSERT(fail1.loadFromFile(WORK_DIR+"Resources/Sounds/Fails/1.ogg"));
soundMap["fail1"].setBuffer(fail1);
ASSERT(fail2.loadFromFile(WORK_DIR+"Resources/Sounds/Fails/2.wav"));
ASSERT(fail2.loadFromFile(WORK_DIR+"Resources/Sounds/Fails/2.ogg"));
soundMap["fail2"].setBuffer(fail2);
ASSERT(fail3.loadFromFile(WORK_DIR+"Resources/Sounds/Fails/3.wav"));
ASSERT(fail3.loadFromFile(WORK_DIR+"Resources/Sounds/Fails/3.ogg"));
soundMap["fail3"].setBuffer(fail3);
ASSERT(fail4.loadFromFile(WORK_DIR+"Resources/Sounds/Fails/4.wav"));
ASSERT(fail4.loadFromFile(WORK_DIR+"Resources/Sounds/Fails/4.ogg"));
soundMap["fail4"].setBuffer(fail4);
ASSERT(fail5.loadFromFile(WORK_DIR+"Resources/Sounds/Fails/5.wav"));
ASSERT(fail5.loadFromFile(WORK_DIR+"Resources/Sounds/Fails/5.ogg"));
soundMap["fail5"].setBuffer(fail5);
ASSERT(fail6.loadFromFile(WORK_DIR+"Resources/Sounds/Fails/6.wav"));
ASSERT(fail6.loadFromFile(WORK_DIR+"Resources/Sounds/Fails/6.ogg"));
soundMap["fail6"].setBuffer(fail6);
ASSERT(note1.loadFromFile(WORK_DIR+"Resources/Sounds/Notes/1.wav"));
ASSERT(note1.loadFromFile(WORK_DIR+"Resources/Sounds/Notes/1.ogg"));
soundMap["note1"].setBuffer(note1);
ASSERT(note2.loadFromFile(WORK_DIR+"Resources/Sounds/Notes/2.wav"));
ASSERT(note2.loadFromFile(WORK_DIR+"Resources/Sounds/Notes/2.ogg"));
soundMap["note2"].setBuffer(note2);
ASSERT(note3.loadFromFile(WORK_DIR+"Resources/Sounds/Notes/3.wav"));
ASSERT(note3.loadFromFile(WORK_DIR+"Resources/Sounds/Notes/3.ogg"));
soundMap["note3"].setBuffer(note3);
ASSERT(note4.loadFromFile(WORK_DIR+"Resources/Sounds/Notes/4.wav"));
ASSERT(note4.loadFromFile(WORK_DIR+"Resources/Sounds/Notes/4.ogg"));
soundMap["note4"].setBuffer(note4);
ASSERT(bona1.loadFromFile(WORK_DIR+"Resources/Sounds/Bona/1.ogg"));
soundMap["bona1"].setBuffer(bona1);
ASSERT(bona2.loadFromFile(WORK_DIR+"Resources/Sounds/Bona/2.ogg"));
soundMap["bona2"].setBuffer(bona2);
ASSERT(bona3.loadFromFile(WORK_DIR+"Resources/Sounds/Bona/3.ogg"));
soundMap["bona3"].setBuffer(bona3);
ASSERT(bona4.loadFromFile(WORK_DIR+"Resources/Sounds/Bona/4.ogg"));
soundMap["bona4"].setBuffer(bona4);
ASSERT(bona5.loadFromFile(WORK_DIR+"Resources/Sounds/Bona/5.ogg"));
soundMap["bona5"].setBuffer(bona5);
ASSERT(bona6.loadFromFile(WORK_DIR+"Resources/Sounds/Bona/6.ogg"));
soundMap["bona6"].setBuffer(bona6);
ASSERT(bona7.loadFromFile(WORK_DIR+"Resources/Sounds/Bona/7.ogg"));
soundMap["bona7"].setBuffer(bona7);
ASSERT(bona8.loadFromFile(WORK_DIR+"Resources/Sounds/Bona/8.ogg"));
soundMap["bona8"].setBuffer(bona8);
}

View file

@ -59,6 +59,14 @@ class SoundManager {
static sf::SoundBuffer note2;
static sf::SoundBuffer note3;
static sf::SoundBuffer note4;
static sf::SoundBuffer bona1;
static sf::SoundBuffer bona2;
static sf::SoundBuffer bona3;
static sf::SoundBuffer bona4;
static sf::SoundBuffer bona5;
static sf::SoundBuffer bona6;
static sf::SoundBuffer bona7;
static sf::SoundBuffer bona8;