aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLoek Le Blansch <loek@pipeframe.xyz>2024-09-29 17:21:36 +0200
committerLoek Le Blansch <loek@pipeframe.xyz>2024-09-29 17:21:36 +0200
commit44da8d4f03be549ddb8b56941e6ab7c3eaca5eca (patch)
treef89fb6e33dd506d2be6d71ab6598753d58a1e205
parent9fa3780a3fc34d6894680aa88d1b37888f3574a9 (diff)
more facade class diagram
-rw-r--r--design.tex22
-rw-r--r--img/facade-audio.puml38
-rw-r--r--img/theme.ipuml3
3 files changed, 51 insertions, 12 deletions
diff --git a/design.tex b/design.tex
index dcde483..9d5f999 100644
--- a/design.tex
+++ b/design.tex
@@ -38,9 +38,29 @@ workflows.
\subsection{Audio}
+\subsubsection{Library}
+
\subsubsection{Fa\c{c}ade}
-\includepumldiag{img/facade-audio.puml}
+\Cref{fig:class-audio-facade} shows a class diagram of the audio fa\c{c}ade. It
+contains the following classes:
+\begin{description}
+ \item[SoundSystem] This is a wrapper around the \codeinline{SoLoud::soloud}
+ `engine' class, and is therefore implemented as a singleton. This ensures the
+ audio engine is initialized before \codeinline{Sound} is able to use it.
+
+ This class is friends with \codeinline{Sound}, so only \codeinline{Sound} is able
+ to get the \codeinline{SoundSystem} instance.
+ \item[Sound] This is a wrapper around the \codeinline{SoLoud::Wav} class, and uses
+ cr\^epe's \codeinline{api::Resource} class to load an audio sample instead.
+\end{description}
+
+\begin{figure}
+ \centering
+ \includepumldiag{img/facade-audio.puml}
+ \caption{Audio fa\c{c}ade class diagram}
+ \label{fig:class-audio-facade}
+\end{figure}
\subsection{Input}
diff --git a/img/facade-audio.puml b/img/facade-audio.puml
index f760652..b256f47 100644
--- a/img/facade-audio.puml
+++ b/img/facade-audio.puml
@@ -4,33 +4,49 @@ skinparam Linetype ortho
package crepe {
- class Sound {
- +Sound(crepe::api::Resource)
+ package api {
+ class Resource <<irrelevant>>
+ }
+ class Sound {
+ +Sound(resource)
+ --
+pause()
+play()
+rewind()
+set_volume(float)
+set_looping(bool)
-
- -_handle : SoLoud::handle
- -_paused : bool
+ --
+ -sample : SoLoud::Wav
+ -handle : SoLoud::handle
+ --
+ -load(resource)
}
- class SoundSystem {
-
+ class SoundSystem <<Singleton>> {
+ -instance() : SoundSystem& <<static>>
+ --
+ -SoundSystem()
+ -~SoundSystem()
+ --
+ -engine : SoLoud::Soloud
}
}
package SoLoud {
- class Soloud
- class Wav
+ class Soloud <<irrelevant>>
+ class Wav <<irrelevant>>
}
' layout
crepe -[hidden]down- SoLoud
-crepe.Sound ..> SoLoud.Wav
-crepe.SoundSystem ..> SoLoud.Soloud
+crepe.Sound --> SoLoud.Wav
+crepe.SoundSystem --> SoLoud.Soloud
+
+crepe.Sound .> crepe.SoundSystem
+crepe.SoundSystem .> crepe.Sound
+
+crepe.Sound .> crepe.api.Resource
@enduml
diff --git a/img/theme.ipuml b/img/theme.ipuml
index 4e3613e..f716ddf 100644
--- a/img/theme.ipuml
+++ b/img/theme.ipuml
@@ -8,3 +8,6 @@ skinparam Nodesep 25
skinparam Padding 2
skinparam Ranksep 50
skinparam RoundCorner 0
+
+hide <<irrelevant>> stereotype
+hide <<irrelevant>> members