RType
src
client
Components
Sound
SoundComponent.hpp
Go to the documentation of this file.
1
/*
2
** EPITECH PROJECT, 2023
3
** R-type
4
** File description:
5
** R-type
6
*/
7
8
#
pragma
once
9
10
#
include
"Components/AComponent.hpp"
11
#
include
<
SFML
/
Audio
.
hpp
>
12
13
class
SoundComponent
:
public
AComponent
14
{
15
public
:
16
17
/**
18
* @brief Construct a new Sound Component:: Sound Component object
19
*
20
* @param core
21
* @param socket
22
*/
23
explicit
SoundComponent
(
ClientCore
*core, std::shared_ptr<
ClientSocket
> socket);
24
25
/**
26
* @brief Destroy the Sound Component:: Sound Component object
27
*
28
*/
29
~
SoundComponent
()
override
=
default
;
30
31
/**
32
* @brief action, play the sound
33
*/
34
void
action
()
override
;
35
36
/**
37
* @brief display, display the sound
38
*
39
* @param window
40
*/
41
void
display
(sf::RenderWindow &window)
override
;
42
43
/**
44
* @brief setSound, set the sound
45
*
46
* @param path the path of the sound
47
*/
48
void
setSound
(
const
std::string &path);
49
50
/**
51
* @brief stop, stop the sound
52
*/
53
void
stop
();
54
55
/**
56
* @brief handleEvent, handle the event
57
*
58
* @param event
59
* @param window
60
*/
61
void
handleEvent
(
const
sf::Event &event, sf::RenderWindow &window)
override
;
62
63
private
:
64
sf::SoundBuffer _buffer;
65
sf::Sound _sound;
66
std::shared_ptr<
ClientSocket
> _socket;
67
};
Generated by
1.9.1