aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--design.tex41
-rw-r--r--img/activity-scripts.puml21
-rw-r--r--img/theme.ipuml14
3 files changed, 65 insertions, 11 deletions
diff --git a/design.tex b/design.tex
index 761658c..340a662 100644
--- a/design.tex
+++ b/design.tex
@@ -69,6 +69,7 @@ architecture:\noparbreak
\end{itemize}
\subsubsection{Architecture}
+\label{sec:scripts:architecture}
The restrictions detailed at the start of this section are mitigated as
follows:\noparbreak
@@ -115,7 +116,8 @@ contains the following classes:\noparbreak
This class also uses a friend relation to \codeinline{ScriptSystem} to restrict
access to its private reference member \codeinline{script}.
\item[ScriptSystem] This is the system class that runs the methods implemented in
- the derivative instances of \codeinline{Script}.
+ the derivative instances of \codeinline{Script}. Described further in
+ \cref{sec:scripts:sytem}.
\end{description}
\begin{figure}
@@ -125,6 +127,32 @@ contains the following classes:\noparbreak
\label{fig:class-scripts}
\end{figure}
+\subsubsection{System}
+\label{sec:scripts:sytem}
+
+Because most of the complexity in the scripting interface comes from the containers
+described in \cref{sec:scripts:architecture}, the script system class itself is
+relatively simple. The script system provides a method
+\codeinline{ScriptSystem::update} that calls all active script's update functions.
+
+Because of the limitation that types cannot be passed as parameters in C++, the
+user-defined script class (derived from \codeinline{Script}) can not directly be
+instantiated when adding the component to the component manager. To work around this
+limitation, the method \codeinline{BehaviorScript::set_script} was created. This
+results in the possibility that an instance of \codeinline{BehaviorScript} does not
+reference an instance of \codeinline{Script}. In addition to the non-active script
+components, the script system skips over these `invalid' instances. This is
+illustrated in \cref{fig:activity-scripts}.
+
+\begin{figure}
+ \centering
+ \includepumldiag{img/activity-scripts.puml}
+ \caption{Script system update method}
+ \label{fig:activity-scripts}
+\end{figure}
+
+A \gls{poc} for the script system
+
\subsection{Audio}
Since writing a custom real-time audio mixing engine is outside the scope of this
@@ -227,5 +255,16 @@ requirements were also set:\noparbreak
% \subsection{Physics}
+\appendix
+
+\section{\Glsfmtlongpl{poc}}
+
+\subsection{Script system}
+\label{poc:scripts}
+
+\subsection{Global configuration interface}
+
+\subsection{Logging utilities}
+
\end{document}
diff --git a/img/activity-scripts.puml b/img/activity-scripts.puml
new file mode 100644
index 0000000..b833bdf
--- /dev/null
+++ b/img/activity-scripts.puml
@@ -0,0 +1,21 @@
+@startuml
+!include theme.ipuml
+
+start
+
+label continue
+:Get list of ""BehaviorScript"" components from ""ComponentManager"";
+
+while (for each ""BehaviorScript"" in list)
+ if (""BehaviorScript"" is active) then (yes)
+ if (""BehaviorScript"" has an instance of ""Script"") then (yes)
+ :Call update function of ""BehaviorScript""'s ""Script"" instance;
+ else (no)
+ endif
+ else (no)
+ endif
+endwhile
+
+stop
+
+@enduml
diff --git a/img/theme.ipuml b/img/theme.ipuml
index 81391e2..c44db05 100644
--- a/img/theme.ipuml
+++ b/img/theme.ipuml
@@ -1,18 +1,10 @@
' vim:ft=plantuml
-
-<style>
-root {
- BackgroundColor white
- FontColor black
- LineThickness 1
- Margin 0
-}
-</style>
-
+!theme plain
skinparam ClassAttributeIconSize 0
skinparam ClassFontStyle bold
skinparam DefaultFontName Inter
skinparam DefaultFontSize 10
+skinparam DefaultMonospacedFontName "JetBrains Mono"
skinparam MaxMessageSize 200
skinparam Nodesep 25
' skinparam Padding 0
@@ -20,6 +12,8 @@ skinparam Ranksep 50
skinparam RoundCorner 0
skinparam PackageStyle rectangle
skinparam PackageFontStyle italic
+skinparam ActivityStartColor black
+skinparam ActivityEndColor black
hide class circle