forked from wrazik/TankBotFight
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rename Tower to Turret, fix Sound class (wrazik#59)
* Rename Tower to Turret, fix Sound class * Install openal on MacOS * Add nproc, add another mac dependency * Add OpenAL
- Loading branch information
Showing
19 changed files
with
130 additions
and
169 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,15 @@ | ||
#include "Sound.hpp" | ||
|
||
Sound::Sound(const Sound& sound) { | ||
mBuffer = sound.mBuffer; | ||
mSound = sound.mSound; | ||
mSound.setBuffer(mBuffer); | ||
} | ||
#include <iostream> | ||
|
||
Sound::Sound(const std::string& file_name) { | ||
if (load_from_file(file_name)) { | ||
mSound.setBuffer(mBuffer); | ||
} else { | ||
std::string path_to_file = files::asset_path() + "Sounds/" + file_name; | ||
if (!mBuffer.loadFromFile(path_to_file)) { | ||
throw std::runtime_error("couldn't load sound"); | ||
} | ||
} | ||
|
||
void Sound::play() { mSound.play(); } | ||
|
||
bool Sound::load_from_file(std::string file_name) { | ||
std::string path_to_file = files::asset_path() + "Sounds/" + file_name; | ||
|
||
return mBuffer.loadFromFile(path_to_file); | ||
} | ||
void Sound::play() { | ||
mSound.setBuffer(mBuffer); | ||
mSound.play(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.