43 PRETTY_DEBUG <<
"Music " << name <<
" is loaded and ready to be played." << std::endl;
52 PRETTY_DEBUG <<
"Music " << name <<
" is loaded and ready to be played." << std::endl;
61 PRETTY_DEBUG <<
"Music " << name <<
" is loaded and ready to be played." << std::endl;
71 PRETTY_DEBUG <<
"Music " << name <<
" is loaded and ready to be played." << std::endl;
80 PRETTY_DEBUG <<
"Music " << name <<
" is loaded and ready to be played." << std::endl;
90 PRETTY_DEBUG <<
"Music " << name <<
" is loaded and ready to be played." << std::endl;
100 PRETTY_DEBUG <<
"Music " << name <<
" is loaded and ready to be played." << std::endl;
111 PRETTY_DEBUG <<
"Music " << name <<
" is loaded and ready to be played." << std::endl;
119 PRETTY_DEBUG <<
"Music " << name <<
" is loaded and ready to be played." << std::endl;
128 PRETTY_DEBUG <<
"Music " << name <<
" is loaded and ready to be played." << std::endl;
137 PRETTY_DEBUG <<
"Music " << name <<
" is loaded and ready to be played." << std::endl;
147 PRETTY_DEBUG <<
"Music " << name <<
" is loaded and ready to be played." << std::endl;
156 PRETTY_DEBUG <<
"Music " << name <<
" is loaded and ready to be played." << std::endl;
166 PRETTY_DEBUG <<
"Music " << name <<
" is loaded and ready to be played." << std::endl;
176 PRETTY_DEBUG <<
"Music " << name <<
" is loaded and ready to be played." << std::endl;
189 PRETTY_DEBUG <<
"Music " << name <<
" is loaded and ready to be played." << std::endl;
203 if (_isInitialised ==
true) {
204 _music.setVolume(_volume);
211 if (_isInitialised ==
true) {
212 _music.setLooping(_isLooping);
223 _isInitialised =
false;
224 if (filePath.empty()) {
227 _filePath = filePath;
228 if (!_music.openFromFile(_filePath)) {
231 _music.setVolume(_volume);
232 _music.setLooping(_isLooping);
233 _isInitialised =
true;
251 _application = application;
256 if (_isInitialised ==
false) {
267 if (_isInitialised ==
false) {
278 if (_isInitialised ==
false) {
309 return _isInitialised;
351 std::string indentation =
"";
352 for (
unsigned int i = 0; i < indent; ++i) {
355 std::string result = indentation +
"Music:\n";
357 result += indentation +
"- Name: " + _name +
"\n";
358 result += indentation +
"- Application: " + _application +
"\n";
359 result += indentation +
"- File Path: " + _filePath +
"\n";
#define PRETTY_DEBUG
Debug log with details and colour.
This is the file that contains the class in charge of managing music.
This is the class in charge of informing the user that the provided file path could not be found.
This is the class in charge of informing the user that they tried to play music from a class that has...
Manages music playback and properties for an entity in the ECS system.
void setMusicName(const std::string &name)
Set the name of the music.
MusicComponent & operator=(const GUI::ECS::Components::MusicComponent ©)
The '=' operator that will allow the user to seamlessly update their music component from another mus...
const bool isLooping() const
Check is the music is looping.
MusicComponent()
Default constructor.
void setApplication(const std::string &application)
Set the Application context of the music.
void play()
Start playing the music.
const std::string getInfo(const unsigned int indent=0) const
This is a function meant for debugging purposes It will dump the current state of the variables upon ...
const float getVolume() const
Get the Volume of the music.
const std::string getFilePath() const
Get the File Path of the music stored in the component.
~MusicComponent()
Destructor.
const bool isPlaying() const
Check if the music is playing.
void setMusic(const std::string &filePath)
Set the music file to load using a file path.
void setLoopMusic(bool loop)
Set if to play the music in a loop or only when asked to.
void pause()
Pause the music.
const bool isInitialised() const
Check if there is an instance of the music to be played in the component.
const bool isStopped() const
Check if the music is stopped.
const std::string getApplication() const
Get the Application context of the music stored in the component.
const std::string getMusicName() const
Get the name of the music stored in the component.
const bool isPaused() const
Check if the music is pause.
void setVolume(float volume)
Set the music Volume (0-100)
void update(const MusicComponent ©)
Copy the values from an existing music component into the current instance.
void stop()
Stop the music.
std::ostream & operator<<(std::ostream &os, const AnimationComponent &item)
Outputs the animation's info to a stream.
const std::string myToString(const Rect< RectType > &rectangle)
Converts a Rect<T> object to its string representation.