RType
Public Member Functions | List of all members
MusicComponent Class Reference

#include <MusicComponent.hpp>

Inheritance diagram for MusicComponent:
Inheritance graph
[legend]
Collaboration diagram for MusicComponent:
Collaboration graph
[legend]

Public Member Functions

 MusicComponent (ClientCore *core, std::shared_ptr< ClientSocket > socket)
 Construct a new Music Component:: Music Component object. More...
 
 ~MusicComponent () override
 Destroy the Music Component:: Music Component object. More...
 
void action () override
 action, play the music More...
 
void display (sf::RenderWindow &window) override
 Display the Music Component. More...
 
void setSound (const std::string &path)
 setSound set the sound of the component More...
 
bool isPlaying () const
 isPlaying More...
 
bool getLoop () const
 getLoop More...
 
float getVolume () const
 getVolume More...
 
bool getPersistant () const
 getPersistant More...
 
void setLoop (bool loop)
 setLoop More...
 
void setPaused (bool paused)
 setPaused More...
 
void setVolume (float volume)
 setVolume More...
 
void setPersistant (bool persistant)
 setPersistant More...
 
void stop ()
 stop, stop the music More...
 
void handleEvent (const sf::Event &event, sf::RenderWindow &window) override
 handleEvent, handle the event More...
 
void handleClick ()
 handleClick, handle the click More...
 
- Public Member Functions inherited from AComponent
 AComponent (ClientCore *clientCore)
 AComponent, constructor of AComponent. More...
 
 ~AComponent () override=default
 ~AComponent, destructor of AComponent More...
 
ComponentType getType () const override
 getType, get the type of the component More...
 
void addActionTarget (std::shared_ptr< IComponent > component) override
 addActionTarget, add a target to the action More...
 
void addSubComponent (std::shared_ptr< IComponent > component) override
 addSubComponent, add a sub component More...
 
void setAttribute (std::string attribute) override
 setAttribute, set the attribute More...
 
std::string getAttribute () override
 getAttribute, get the attribute More...
 
- Public Member Functions inherited from IComponent
 IComponent (ClientCore *clientCore)
 IComponent, constructor of IComponent. More...
 
virtual ~IComponent ()=default
 ~IComponent, destructor of IComponent More...
 

Additional Inherited Members

- Protected Attributes inherited from IComponent
std::string _attribute
 
ComponentType _type
 
std::vector< std::shared_ptr< IComponent > > action_target
 
std::vector< std::shared_ptr< IComponent > > sub_components
 
ClientCore_clientCore
 

Detailed Description

Definition at line 13 of file MusicComponent.hpp.

Constructor & Destructor Documentation

◆ MusicComponent()

MusicComponent::MusicComponent ( ClientCore core,
std::shared_ptr< ClientSocket socket 
)
explicit

Construct a new Music Component:: Music Component object.

Parameters
core
socket

Definition at line 17 of file MusicComponent.cpp.

References IComponent::_clientCore, IComponent::_type, AComponent::AComponent(), and MUSIC.

Here is the call graph for this function:

◆ ~MusicComponent()

MusicComponent::~MusicComponent ( )
override

Destroy the Music Component:: Music Component object.

Definition at line 33 of file MusicComponent.cpp.

Member Function Documentation

◆ action()

void MusicComponent::action ( )
overridevirtual

action, play the music

Implements IComponent.

Definition at line 55 of file MusicComponent.cpp.

◆ display()

void MusicComponent::display ( sf::RenderWindow &  window)
overridevirtual

Display the Music Component.

Parameters
window

Implements IComponent.

Definition at line 43 of file MusicComponent.cpp.

◆ getLoop()

bool MusicComponent::getLoop ( ) const

getLoop

getLoop get the music loop

Returns
true if the music is looping
the music loop

Definition at line 91 of file MusicComponent.cpp.

◆ getPersistant()

bool MusicComponent::getPersistant ( ) const

getPersistant

getPersistant get the music persistant

Returns
true if the music is persistant
the music persistant

Definition at line 171 of file MusicComponent.cpp.

◆ getVolume()

float MusicComponent::getVolume ( ) const

getVolume

getVolume get the music volume

Returns
the volume of the music
the music volume

Definition at line 100 of file MusicComponent.cpp.

◆ handleClick()

void MusicComponent::handleClick ( )

handleClick, handle the click

handleClick

Definition at line 145 of file MusicComponent.cpp.

◆ handleEvent()

void MusicComponent::handleEvent ( const sf::Event event,
sf::RenderWindow &  window 
)
overridevirtual

handleEvent, handle the event

handle Event for the Music Component

Parameters
event
window

Implements IComponent.

Definition at line 63 of file MusicComponent.cpp.

◆ isPlaying()

bool MusicComponent::isPlaying ( ) const

isPlaying

isPlaying,

Returns
true if the music is playing
the status of the music

Definition at line 81 of file MusicComponent.cpp.

◆ setLoop()

void MusicComponent::setLoop ( bool  loop)

setLoop

setLoop set the music loop

Parameters
loop

Definition at line 109 of file MusicComponent.cpp.

◆ setPaused()

void MusicComponent::setPaused ( bool  paused)

setPaused

setPaused set the music paused

Parameters
paused

Definition at line 118 of file MusicComponent.cpp.

◆ setPersistant()

void MusicComponent::setPersistant ( bool  persistant)

setPersistant

setPersistant set the music persistant

Parameters
persistant

Definition at line 162 of file MusicComponent.cpp.

◆ setSound()

void MusicComponent::setSound ( const std::string &  path)

setSound set the sound of the component

set the Sound

Parameters
path

Definition at line 71 of file MusicComponent.cpp.

◆ setVolume()

void MusicComponent::setVolume ( float  volume)

setVolume

setVolume set the music volume

Parameters
volume

Definition at line 136 of file MusicComponent.cpp.

◆ stop()

void MusicComponent::stop ( )

stop, stop the music

Definition at line 152 of file MusicComponent.cpp.


The documentation for this class was generated from the following files: