|
R-Type
2
Doom but in better
|
Manages music playback and properties for an entity in the ECS system. More...
#include <MusicComponent.hpp>


Public Member Functions | |
| MusicComponent () | |
| Default constructor. | |
| MusicComponent (const std::uint32_t entityId) | |
| Constructor with an entity ID. | |
| MusicComponent (const MusicComponent &music) | |
| Copy constructor. | |
| MusicComponent (const std::uint32_t entityId, const MusicComponent &music) | |
| Constructor with an entity ID and another MusicComponent to copy. | |
| MusicComponent (const std::string &filePath, const std::string &name) | |
| Constructor that initializes the music with a file path and name. | |
| MusicComponent (const std::string &filePath, const std::string &name, bool loop) | |
| Constructor that initializes the music with a file path, name, and looping option. | |
| MusicComponent (const std::string &filePath, const std::string &name, float volume) | |
| Constructor that initializes the music with a file path, name, and volume. | |
| MusicComponent (const std::string &filePath, const std::string &name, float volume, bool loop) | |
| Constructor that initializes the music with a file path, name, volume, and looping option. | |
| MusicComponent (const std::string &filePath, const std::string &name, const std::string &application) | |
| Constructor that initializes the music with a file path, name, and associated application. | |
| MusicComponent (const std::string &filePath, const std::string &name, const std::string &application, bool loop) | |
| Constructor that initializes the music with a file path, name, associated application, and looping option. | |
| MusicComponent (const std::string &filePath, const std::string &name, const std::string &application, float volume) | |
| Constructor that initializes the music with a file path, name, associated application, and volume. | |
| MusicComponent (const std::string &filePath, const std::string &name, const std::string &application, float volume, bool loop) | |
| Constructor that initializes the music with a file path, name, associated application, volume, and looping option. | |
| MusicComponent (const std::uint32_t entityId, const std::string &filePath, const std::string &name) | |
| Constructor that initializes the music with an entity ID, file path, and name. | |
| MusicComponent (const std::uint32_t entityId, const std::string &filePath, const std::string &name, bool loop) | |
| Constructor that initializes the music with an entity ID, file path, name, and looping option. | |
| MusicComponent (const std::uint32_t entityId, const std::string &filePath, const std::string &name, float volume) | |
| Constructor that initializes the music with an entity ID, file path, name, and volume. | |
| MusicComponent (const std::uint32_t entityId, const std::string &filePath, const std::string &name, float volume, bool loop) | |
| Constructor that initializes the music with an entity ID, file path, name, volume, and looping option. | |
| MusicComponent (const std::uint32_t entityId, const std::string &filePath, const std::string &name, const std::string &application) | |
| Constructor that initializes the music with an entity ID, file path, name, and associated application. | |
| MusicComponent (const std::uint32_t entityId, const std::string &filePath, const std::string &name, const std::string &application, bool loop) | |
| Constructor that initializes the music with an entity ID, file path, name, associated application, and looping option. | |
| MusicComponent (const std::uint32_t entityId, const std::string &filePath, const std::string &name, const std::string &application, float volume) | |
| Constructor that initializes the music with an entity ID, file path, name, associated application, and volume. | |
| MusicComponent (const std::uint32_t entityId, const std::string &filePath, const std::string &name, const std::string &application, float volume, bool loop) | |
| Constructor that initializes the music with an entity ID, file path, name, associated application, volume, and looping option. | |
| ~MusicComponent () | |
| Destructor. | |
| void | setVolume (float volume) |
| Set the music Volume (0-100) | |
| void | setLoopMusic (bool loop) |
| Set if to play the music in a loop or only when asked to. | |
| void | setMusicName (const std::string &name) |
| Set the name of the music. | |
| void | setMusic (const std::string &filePath) |
| Set the music file to load using a file path. | |
| void | setMusic (const std::string &filePath, const std::string &name) |
| Set the Music file to load via a file path as well as setting the name of the music. | |
| void | setMusic (const std::string &filePath, const std::string &name, float volume) |
| Set the Music file to load via file path as well as it's name and volume. | |
| void | setApplication (const std::string &application) |
| Set the Application context of the music. | |
| void | play () |
| Start playing the music. | |
| void | stop () |
| Stop the music. | |
| void | pause () |
| Pause the music. | |
| const bool | isPaused () const |
| Check if the music is pause. | |
| const bool | isPlaying () const |
| Check if the music is playing. | |
| const bool | isStopped () const |
| Check if the music is stopped. | |
| const bool | isLooping () const |
| Check is the music is looping. | |
| const bool | isInitialised () const |
| Check if there is an instance of the music to be played in the component. | |
| void | update (const MusicComponent ©) |
| Copy the values from an existing music component into the current instance. | |
| const float | getVolume () const |
| Get the Volume of the music. | |
| const std::string | getMusicName () const |
| Get the name of the music stored in the component. | |
| const std::string | getFilePath () const |
| Get the File Path of the music stored in the component. | |
| const std::string | getApplication () const |
| Get the Application context of the music stored in the component. | |
| 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 call. It will dump them for itself and any of it's underlying classes. | |
| MusicComponent & | operator= (const GUI::ECS::Components::MusicComponent ©) |
| The '=' operator that will allow the user to seamlessly update their music component from another music component. | |
Public Member Functions inherited from GUI::ECS::EntityNode | |
| EntityNode (const size_t entityId=0) | |
| virtual | ~EntityNode ()=default |
| virtual size_t | getEntityNodeId () const |
Additional Inherited Members | |
Protected Attributes inherited from GUI::ECS::EntityNode | |
| size_t | _entityID |
Manages music playback and properties for an entity in the ECS system.
Definition at line 36 of file MusicComponent.hpp.
| GUI::ECS::Components::MusicComponent::MusicComponent | ( | ) |
Default constructor.
Definition at line 16 of file MusicComponent.cpp.
| GUI::ECS::Components::MusicComponent::MusicComponent | ( | const std::uint32_t | entityId | ) |
Constructor with an entity ID.
| entityId | The ID of the entity associated with this component. |
Definition at line 21 of file MusicComponent.cpp.
| GUI::ECS::Components::MusicComponent::MusicComponent | ( | const MusicComponent & | music | ) |
Copy constructor.
| music | The MusicComponent instance to copy from. |
Definition at line 26 of file MusicComponent.cpp.
| GUI::ECS::Components::MusicComponent::MusicComponent | ( | const std::uint32_t | entityId, |
| const MusicComponent & | music ) |
Constructor with an entity ID and another MusicComponent to copy.
| entityId | The ID of the entity associated with this component. |
| music | The MusicComponent instance to copy from. |
Definition at line 32 of file MusicComponent.cpp.
| GUI::ECS::Components::MusicComponent::MusicComponent | ( | const std::string & | filePath, |
| const std::string & | name ) |
Constructor that initializes the music with a file path and name.
| filePath | The file path of the music. |
| name | The name of the music. |
Definition at line 38 of file MusicComponent.cpp.
| GUI::ECS::Components::MusicComponent::MusicComponent | ( | const std::string & | filePath, |
| const std::string & | name, | ||
| bool | loop ) |
Constructor that initializes the music with a file path, name, and looping option.
| filePath | The file path of the music. |
| name | The name of the music. |
| loop | Whether the music should loop. |
Definition at line 46 of file MusicComponent.cpp.
| GUI::ECS::Components::MusicComponent::MusicComponent | ( | const std::string & | filePath, |
| const std::string & | name, | ||
| float | volume ) |
Constructor that initializes the music with a file path, name, and volume.
| filePath | The file path of the music. |
| name | The name of the music. |
| volume | The volume of the music (0-100). |
Definition at line 55 of file MusicComponent.cpp.
| GUI::ECS::Components::MusicComponent::MusicComponent | ( | const std::string & | filePath, |
| const std::string & | name, | ||
| float | volume, | ||
| bool | loop ) |
Constructor that initializes the music with a file path, name, volume, and looping option.
| filePath | The file path of the music. |
| name | The name of the music. |
| volume | The volume of the music (0-100). |
| loop | Whether the music should loop. |
Definition at line 64 of file MusicComponent.cpp.
| GUI::ECS::Components::MusicComponent::MusicComponent | ( | const std::string & | filePath, |
| const std::string & | name, | ||
| const std::string & | application ) |
Constructor that initializes the music with a file path, name, and associated application.
| filePath | The file path of the music. |
| name | The name of the music. |
| application | The name of the application associated with the music. |
Definition at line 74 of file MusicComponent.cpp.
| GUI::ECS::Components::MusicComponent::MusicComponent | ( | const std::string & | filePath, |
| const std::string & | name, | ||
| const std::string & | application, | ||
| bool | loop ) |
Constructor that initializes the music with a file path, name, associated application, and looping option.
| filePath | The file path of the music. |
| name | The name of the music. |
| application | The name of the application associated with the music. |
| loop | Whether the music should loop. |
Definition at line 83 of file MusicComponent.cpp.
| GUI::ECS::Components::MusicComponent::MusicComponent | ( | const std::string & | filePath, |
| const std::string & | name, | ||
| const std::string & | application, | ||
| float | volume ) |
Constructor that initializes the music with a file path, name, associated application, and volume.
| filePath | The file path of the music. |
| name | The name of the music. |
| application | The name of the application associated with the music. |
| volume | The volume of the music (0-100). |
Definition at line 93 of file MusicComponent.cpp.
| GUI::ECS::Components::MusicComponent::MusicComponent | ( | const std::string & | filePath, |
| const std::string & | name, | ||
| const std::string & | application, | ||
| float | volume, | ||
| bool | loop ) |
Constructor that initializes the music with a file path, name, associated application, volume, and looping option.
| filePath | The file path of the music. |
| name | The name of the music. |
| application | The name of the application associated with the music. |
| volume | The volume of the music (0-100). |
| loop | Whether the music should loop. |
Definition at line 103 of file MusicComponent.cpp.
| GUI::ECS::Components::MusicComponent::MusicComponent | ( | const std::uint32_t | entityId, |
| const std::string & | filePath, | ||
| const std::string & | name ) |
Constructor that initializes the music with an entity ID, file path, and name.
| entityId | The ID of the entity associated with this component. |
| filePath | The file path of the music. |
| name | The name of the music. |
Definition at line 114 of file MusicComponent.cpp.
| GUI::ECS::Components::MusicComponent::MusicComponent | ( | const std::uint32_t | entityId, |
| const std::string & | filePath, | ||
| const std::string & | name, | ||
| bool | loop ) |
Constructor that initializes the music with an entity ID, file path, name, and looping option.
| entityId | The ID of the entity associated with this component. |
| filePath | The file path of the music. |
| name | The name of the music. |
| loop | Whether the music should loop. |
Definition at line 122 of file MusicComponent.cpp.
| GUI::ECS::Components::MusicComponent::MusicComponent | ( | const std::uint32_t | entityId, |
| const std::string & | filePath, | ||
| const std::string & | name, | ||
| float | volume ) |
Constructor that initializes the music with an entity ID, file path, name, and volume.
| entityId | The ID of the entity associated with this component. |
| filePath | The file path of the music. |
| name | The name of the music. |
| volume | The volume of the music (0-100). |
Definition at line 131 of file MusicComponent.cpp.
| GUI::ECS::Components::MusicComponent::MusicComponent | ( | const std::uint32_t | entityId, |
| const std::string & | filePath, | ||
| const std::string & | name, | ||
| float | volume, | ||
| bool | loop ) |
Constructor that initializes the music with an entity ID, file path, name, volume, and looping option.
| entityId | The ID of the entity associated with this component. |
| filePath | The file path of the music. |
| name | The name of the music. |
| volume | The volume of the music (0-100). |
| loop | Whether the music should loop. |
Definition at line 140 of file MusicComponent.cpp.
| GUI::ECS::Components::MusicComponent::MusicComponent | ( | const std::uint32_t | entityId, |
| const std::string & | filePath, | ||
| const std::string & | name, | ||
| const std::string & | application ) |
Constructor that initializes the music with an entity ID, file path, name, and associated application.
| entityId | The ID of the entity associated with this component. |
| filePath | The file path of the music. |
| name | The name of the music. |
| application | The name of the application associated with the music. |
Definition at line 150 of file MusicComponent.cpp.
| GUI::ECS::Components::MusicComponent::MusicComponent | ( | const std::uint32_t | entityId, |
| const std::string & | filePath, | ||
| const std::string & | name, | ||
| const std::string & | application, | ||
| bool | loop ) |
Constructor that initializes the music with an entity ID, file path, name, associated application, and looping option.
| entityId | The ID of the entity associated with this component. |
| filePath | The file path of the music. |
| name | The name of the music. |
| application | The name of the application associated with the music. |
| loop | Whether the music should loop. |
Definition at line 159 of file MusicComponent.cpp.
| GUI::ECS::Components::MusicComponent::MusicComponent | ( | const std::uint32_t | entityId, |
| const std::string & | filePath, | ||
| const std::string & | name, | ||
| const std::string & | application, | ||
| float | volume ) |
Constructor that initializes the music with an entity ID, file path, name, associated application, and volume.
| entityId | The ID of the entity associated with this component. |
| filePath | The file path of the music. |
| name | The name of the music. |
| application | The name of the application associated with the music. |
| volume | The volume of the music (0-100). |
Definition at line 169 of file MusicComponent.cpp.
| GUI::ECS::Components::MusicComponent::MusicComponent | ( | const std::uint32_t | entityId, |
| const std::string & | filePath, | ||
| const std::string & | name, | ||
| const std::string & | application, | ||
| float | volume, | ||
| bool | loop ) |
Constructor that initializes the music with an entity ID, file path, name, associated application, volume, and looping option.
| entityId | The ID of the entity associated with this component. |
| filePath | The file path of the music. |
| name | The name of the music. |
| application | The name of the application associated with the music. |
| volume | The volume of the music (0-100). |
| loop | Whether the music should loop. |
Definition at line 181 of file MusicComponent.cpp.
| GUI::ECS::Components::MusicComponent::~MusicComponent | ( | ) |
Destructor.
Definition at line 192 of file MusicComponent.cpp.
| const std::string GUI::ECS::Components::MusicComponent::getApplication | ( | ) | const |
Get the Application context of the music stored in the component.
Definition at line 343 of file MusicComponent.cpp.
| const std::string GUI::ECS::Components::MusicComponent::getFilePath | ( | ) | const |
Get the File Path of the music stored in the component.
Definition at line 338 of file MusicComponent.cpp.
| const std::string GUI::ECS::Components::MusicComponent::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 call. It will dump them for itself and any of it's underlying classes.
| indent | The level to which the class should be indented in the dump. |
Definition at line 348 of file MusicComponent.cpp.
| const std::string GUI::ECS::Components::MusicComponent::getMusicName | ( | ) | const |
Get the name of the music stored in the component.
Definition at line 333 of file MusicComponent.cpp.
| const float GUI::ECS::Components::MusicComponent::getVolume | ( | ) | const |
| const bool GUI::ECS::Components::MusicComponent::isInitialised | ( | ) | const |
Check if there is an instance of the music to be played in the component.
Definition at line 307 of file MusicComponent.cpp.
| const bool GUI::ECS::Components::MusicComponent::isLooping | ( | ) | const |
Check is the music is looping.
Definition at line 302 of file MusicComponent.cpp.
| const bool GUI::ECS::Components::MusicComponent::isPaused | ( | ) | const |
Check if the music is pause.
Definition at line 287 of file MusicComponent.cpp.
| const bool GUI::ECS::Components::MusicComponent::isPlaying | ( | ) | const |
Check if the music is playing.
Definition at line 292 of file MusicComponent.cpp.
| const bool GUI::ECS::Components::MusicComponent::isStopped | ( | ) | const |
Check if the music is stopped.
Definition at line 297 of file MusicComponent.cpp.
| GUI::ECS::Components::MusicComponent & GUI::ECS::Components::MusicComponent::operator= | ( | const GUI::ECS::Components::MusicComponent & | copy | ) |
The '=' operator that will allow the user to seamlessly update their music component from another music component.
| copy |
Definition at line 369 of file MusicComponent.cpp.
| void GUI::ECS::Components::MusicComponent::pause | ( | ) |
Pause the music.
Definition at line 276 of file MusicComponent.cpp.
| void GUI::ECS::Components::MusicComponent::play | ( | ) |
Start playing the music.
Definition at line 254 of file MusicComponent.cpp.
| void GUI::ECS::Components::MusicComponent::setApplication | ( | const std::string & | application | ) |
Set the Application context of the music.
| application |
Definition at line 249 of file MusicComponent.cpp.
| void GUI::ECS::Components::MusicComponent::setLoopMusic | ( | bool | loop | ) |
Set if to play the music in a loop or only when asked to.
| loop |
Definition at line 208 of file MusicComponent.cpp.
| void GUI::ECS::Components::MusicComponent::setMusic | ( | const std::string & | filePath | ) |
Set the music file to load using a file path.
| filePath |
Definition at line 221 of file MusicComponent.cpp.
| void GUI::ECS::Components::MusicComponent::setMusic | ( | const std::string & | filePath, |
| const std::string & | name ) |
Set the Music file to load via a file path as well as setting the name of the music.
| filePath | |
| name |
Definition at line 236 of file MusicComponent.cpp.
| void GUI::ECS::Components::MusicComponent::setMusic | ( | const std::string & | filePath, |
| const std::string & | name, | ||
| float | volume ) |
Set the Music file to load via file path as well as it's name and volume.
| filePath | |
| name | |
| volume |
Definition at line 242 of file MusicComponent.cpp.
| void GUI::ECS::Components::MusicComponent::setMusicName | ( | const std::string & | name | ) |
| void GUI::ECS::Components::MusicComponent::setVolume | ( | float | volume | ) |
| void GUI::ECS::Components::MusicComponent::stop | ( | ) |
Stop the music.
Definition at line 265 of file MusicComponent.cpp.
| void GUI::ECS::Components::MusicComponent::update | ( | const MusicComponent & | copy | ) |
Copy the values from an existing music component into the current instance.
| copy | The music component to copy from |
Definition at line 312 of file MusicComponent.cpp.