RType
src
client
Components
Music
MusicComponent.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
MusicComponent
:
public
AComponent
14
{
15
public
:
16
17
/**
18
* @brief Construct a new Music Component:: Music Component object
19
*
20
* @param core
21
* @param socket
22
*/
23
explicit
MusicComponent
(
ClientCore
*core, std::shared_ptr<
ClientSocket
> socket);
24
25
/**
26
* @brief Destroy the Music Component:: Music Component object
27
*
28
*/
29
~
MusicComponent
()
override
;
30
31
/**
32
* @brief action, play the music
33
*/
34
void
action
()
override
;
35
36
/**
37
* @brief Display the Music Component
38
*
39
* @param window
40
*/
41
void
display
(sf::RenderWindow &window)
override
;
42
43
/**
44
* @brief setSound set the sound of the component
45
*
46
* @param path
47
*/
48
void
setSound
(
const
std::string &path);
49
50
/**
51
* @brief isPlaying
52
*
53
* @return true if the music is playing
54
*/
55
bool
isPlaying
()
const
;
56
57
/**
58
* @brief getLoop
59
*
60
* @return true if the music is looping
61
*/
62
bool
getLoop
()
const
;
63
64
/**
65
* @brief getVolume
66
*
67
* @return the volume of the music
68
*/
69
float
getVolume
()
const
;
70
71
/**
72
* @brief getPersistant
73
*
74
* @return true if the music is persistant
75
*/
76
bool
getPersistant
()
const
;
77
78
/**
79
* @brief setLoop
80
*
81
* @param loop
82
*/
83
void
setLoop
(
bool
loop);
84
85
/**
86
* @brief setPaused
87
*
88
* @param paused
89
*/
90
void
setPaused
(
bool
paused);
91
92
/**
93
* @brief setVolume
94
*
95
* @param volume
96
*/
97
void
setVolume
(
float
volume);
98
99
/**
100
* @brief setPersistant
101
*
102
* @param persistant
103
*/
104
void
setPersistant
(
bool
persistant);
105
106
/**
107
* @brief stop, stop the music
108
*/
109
void
stop
();
110
111
/**
112
* @brief handleEvent, handle the event
113
*
114
* @param event
115
* @param window
116
*/
117
void
handleEvent
(
const
sf::Event &event, sf::RenderWindow &window)
override
;
118
119
/**
120
* @brief handleClick, handle the click
121
*/
122
void
handleClick
();
123
124
private
:
125
sf::Music _music;
126
std::shared_ptr<
ClientSocket
> _socket;
127
bool
_toPlay =
true
;
128
float
_volume = 100;
129
bool
_persistant =
false
;
130
};
Generated by
1.9.1