Dragonfly 4.19
A text-based game engine
Public Member Functions | Private Attributes | List of all members
df::Sound Class Reference

Public Member Functions

int loadSound (std::string filename)
 
void setLabel (std::string new_label)
 
std::string getLabel () const
 
void play (bool loop=false)
 
void stop ()
 
void pause ()
 
sf::Sound getSound () const
 

Private Attributes

sf::Sound m_sound
 
sf::SoundBuffer m_sound_buffer
 
std::string m_label
 

Member Function Documentation

◆ getLabel()

std::string df::Sound::getLabel ( ) const

Get label associated with sound.

◆ getSound()

sf::Sound df::Sound::getSound ( ) const

Return SFML sound.

◆ loadSound()

int df::Sound::loadSound ( std::string  filename)

Load sound buffer from file.

Return 0 if ok, else -1.

◆ pause()

void df::Sound::pause ( )

Pause sound.

◆ play()

void df::Sound::play ( bool  loop = false)

Play sound.

If loop is true, repeat play when done.

◆ setLabel()

void df::Sound::setLabel ( std::string  new_label)

Set label associated with sound.

◆ stop()

void df::Sound::stop ( )

Stop sound.

Member Data Documentation

◆ m_label

std::string df::Sound::m_label
private

Text label to identify sound.

◆ m_sound

sf::Sound df::Sound::m_sound
private

SFML sound.

◆ m_sound_buffer

sf::SoundBuffer df::Sound::m_sound_buffer
private

SFML sound buffer associated with sound.