added sound buffers

This commit is contained in:
Ralusama19 2017-01-21 14:29:08 +01:00
parent 66377e60ee
commit cc0d1e80eb
5 changed files with 12 additions and 7 deletions

View file

@ -53,6 +53,9 @@ void Character::setState(PlayerState::playerState state){
idleFrame = indexX; idleFrame = indexX;
indexX = 0; indexX = 0;
indexY = 1 + magicNumber; indexY = 1 + magicNumber;
std::string sample = "atk"+std::to_string(rand()%20+1);
SoundManager::playSound(sample);
std::cout << "playing sample " << sample << std::endl;
} }
else if (false /*state == PlayerState::damaged*/){ else if (false /*state == PlayerState::damaged*/){
indexX = 0; indexX = 0;

View file

@ -8,7 +8,6 @@ Combat::Combat() {
// enemy = new IaEnemy(1); // enemy = new IaEnemy(1);
enemy = new Player(1); enemy = new Player(1);
initShader(); initShader();
SoundManager::load();
SoundManager::playMusic("music"); SoundManager::playMusic("music");
} }

View file

@ -6,11 +6,12 @@
#include <SFML/Graphics.hpp> #include <SFML/Graphics.hpp>
#include <assert.h> #include <assert.h>
#include <stdlib.h> /* getenv */ #include <stdlib.h> /* getenv */
#include <stdlib.h> /* srand, rand */
#include <time.h> /* time */
#include <iostream> #include <iostream>
#include <string> #include <string>
#include "soundmanager.hpp"
const int SCENE_NUM = 4; const int SCENE_NUM = 4;
#define MARGEERR 0.05f #define MARGEERR 0.05f
#define BLACKVALUE 0.60f #define BLACKVALUE 0.60f
#define W_WIDTH 800 #define W_WIDTH 800

View file

@ -1,6 +1,7 @@
#include "mygame.hpp" #include "mygame.hpp"
#include "compas.hpp" #include "compas.hpp"
int main() { int main() {
srand (time(NULL));
MyGame game; MyGame game;
game.run(); game.run();
return 0; return 0;

View file

@ -9,6 +9,7 @@ MyGame::MyGame() {
_scenes[GameScene::help] = _menu; _scenes[GameScene::help] = _menu;
_scenes[GameScene::credits] = _menu; _scenes[GameScene::credits] = _menu;
std::cout << "in menu" << std::endl; std::cout << "in menu" << std::endl;
SoundManager::load();
} }
MyGame::~MyGame() { MyGame::~MyGame() {