Skip to content

Commit eb6a45d

Browse files
author
Software Antics
committed
More documentation
1 parent 328a2ff commit eb6a45d

19 files changed

+1563
-1223
lines changed

FinalEngine.Audio.OpenAL/Factories/CASLSoundFactory.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ namespace FinalEngine.Audio.OpenAL.Factories;
99
using CASLSound = CASL.Sound;
1010
using ICASLSound = CASL.ISound;
1111

12-
[ExcludeFromCodeCoverage]
12+
[ExcludeFromCodeCoverage(Justification = "Invocation")]
1313
internal sealed class CASLSoundFactory : ICASLSoundFactory
1414
{
1515
public ICASLSound CreateSound(string filePath)

FinalEngine.Audio.OpenAL/FinalEngine.Audio.OpenAL.csproj

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@
33
<PropertyGroup>
44
<TargetFramework>net8.0</TargetFramework>
55
<Nullable>enable</Nullable>
6-
<NoWarn>SA0001</NoWarn>
76
<AnalysisMode>All</AnalysisMode>
87
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
8+
<GenerateDocumentationFile>true</GenerateDocumentationFile>
99
<Platforms>x64</Platforms>
1010
</PropertyGroup>
1111

FinalEngine.Audio.OpenAL/Loaders/SoundResourceLoader.cs

+28-1
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,25 @@ namespace FinalEngine.Audio.OpenAL.Loaders;
1111
using FinalEngine.Audio.OpenAL.Factories;
1212
using FinalEngine.Resources;
1313

14+
/// <summary>
15+
/// Provides an <see cref="ISound"/> resource loader.
16+
/// </summary>
17+
///
18+
/// <seealso cref="ResourceLoaderBase{TResource}"/>
1419
public class SoundResourceLoader : ResourceLoaderBase<ISound>
1520
{
1621
private readonly ICASLSoundFactory factory;
1722

1823
private readonly IFileSystem fileSystem;
1924

20-
[ExcludeFromCodeCoverage]
25+
/// <summary>
26+
/// Initializes a new instance of the <see cref="SoundResourceLoader"/> class.
27+
/// </summary>
28+
///
29+
/// <param name="fileSystem">
30+
/// The file system used to load <see cref="ISound"/> resources.
31+
/// </param>
32+
[ExcludeFromCodeCoverage(Justification = "Cannot unit test")]
2133
public SoundResourceLoader(IFileSystem fileSystem)
2234
: this(fileSystem, new CASLSoundFactory())
2335
{
@@ -29,6 +41,21 @@ internal SoundResourceLoader(IFileSystem fileSystem, ICASLSoundFactory factory)
2941
this.factory = factory ?? throw new ArgumentNullException(nameof(factory));
3042
}
3143

44+
/// <summary>
45+
/// Loads a <see cref="ISound"/> resource from the specified <paramref name="filePath" />.
46+
/// </summary>
47+
///
48+
/// <param name="filePath">
49+
/// The file path of the resource to load.
50+
/// </param>
51+
///
52+
/// <returns>
53+
/// The loaded resource, of type <see cref="ISound"/>.
54+
/// </returns>
55+
///
56+
/// <exception cref="System.IO.FileNotFoundException">
57+
/// The specified <paramref name="filePath"/> parameter cannot be located on the current file system.
58+
/// </exception>
3259
public override ISound LoadResource(string filePath)
3360
{
3461
ArgumentException.ThrowIfNullOrWhiteSpace(filePath, nameof(filePath));

FinalEngine.ECS/Attributes/EntitySystemProcessAttribute.cs

+15
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,23 @@ namespace FinalEngine.ECS.Attributes;
66

77
using System;
88

9+
/// <summary>
10+
/// Provides an attribute used to determine when an <see cref="EntitySystemBase"/> will execute.
11+
/// </summary>
12+
/// <seealso cref="System.Attribute" />
913
[AttributeUsage(AttributeTargets.Class, AllowMultiple = false)]
1014
public sealed class EntitySystemProcessAttribute : Attribute
1115
{
16+
/// <summary>
17+
/// Gets the type of the execution.
18+
/// </summary>
19+
///
20+
/// <value>
21+
/// The type of the execution.
22+
/// </value>
23+
///
24+
/// <remarks>
25+
/// The <see cref="ExecutionType"/> determines when the associated system will be executed.
26+
/// </remarks>
1227
public GameLoopType ExecutionType { get; init; }
1328
}

FinalEngine.ECS/Components/Core/TagComponent.cs

+20
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,33 @@ namespace FinalEngine.ECS.Components.Core;
66

77
using System.ComponentModel;
88

9+
/// <summary>
10+
/// Represents a tag for an <see cref="Entity"/>.
11+
/// </summary>
12+
///
13+
/// <remarks>
14+
/// An <see cref="Entity"/> can be associated with a tag for identification. However, an <see cref="Entity"/> also has a unique identifier - see <see cref="Entity.UniqueIdentifier"/>.
15+
/// </remarks>
16+
///
17+
/// <seealso cref="IEntityComponent" />
18+
/// <seealso cref="INotifyPropertyChanged" />
919
[Category("Core")]
1020
public sealed class TagComponent : IEntityComponent, INotifyPropertyChanged
1121
{
1222
private string? name;
1323

24+
/// <summary>
25+
/// Occurs when a property value changes.
26+
/// </summary>
1427
public event PropertyChangedEventHandler? PropertyChanged;
1528

29+
/// <summary>
30+
/// Gets or sets the name (or tag).
31+
/// </summary>
32+
///
33+
/// <value>
34+
/// The name (or tag).
35+
/// </value>
1636
public string? Name
1737
{
1838
get

FinalEngine.ECS/FinalEngine.ECS.csproj

+1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
<Nullable>enable</Nullable>
66
<AnalysisMode>All</AnalysisMode>
77
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
8+
<GenerateDocumentationFile>true</GenerateDocumentationFile>
89
<Platforms>x64</Platforms>
910
<NoWarn>SA0001</NoWarn>
1011
</PropertyGroup>

FinalEngine.ECS/IEntityFactory.cs

+14
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,21 @@
44

55
namespace FinalEngine.ECS;
66

7+
/// <summary>
8+
/// Defines an interface that provides a method to create an <see cref="Entity"/>.
9+
/// </summary>
10+
///
11+
/// <remarks>
12+
/// You should implement this interface in a scenario where an <see cref="Entity"/> must be created and assigned a default collection of components and can be reused. It simply provides a means to simplify the relationship between entities and components.
13+
/// </remarks>
714
public interface IEntityFactory
815
{
16+
/// <summary>
17+
/// Creates the entity.
18+
/// </summary>
19+
///
20+
/// <returns>
21+
/// The newly created <see cref="Entity"/>.
22+
/// </returns>
923
Entity CreateEntity();
1024
}

FinalEngine.ECS/IEntitySystemsProcessor.cs

-10
This file was deleted.

FinalEngine.ECS/IEntityWorld.cs

+3-1
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,14 @@ namespace FinalEngine.ECS;
66

77
using System;
88

9-
public interface IEntityWorld : IEntitySystemsProcessor
9+
public interface IEntityWorld
1010
{
1111
void AddEntity(Entity entity);
1212

1313
void AddSystem(EntitySystemBase system);
1414

15+
void ProcessAll(GameLoopType type);
16+
1517
void RemoveEntity(Entity entity);
1618

1719
void RemoveSystem(Type type);

FinalEngine.Maths/MathHelper.cs

+58
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,71 @@ namespace FinalEngine.Maths;
66

77
using System;
88

9+
/// <summary>
10+
/// Provides helper methods for mathematical operations.
11+
/// </summary>
912
public static class MathHelper
1013
{
14+
/// <summary>
15+
/// Converts the specified <paramref name="angle"/> from degrees to radians.
16+
/// </summary>
17+
///
18+
/// <param name="angle">
19+
/// The angle in degrees.
20+
/// </param>
21+
///
22+
/// <returns>
23+
/// The equivalent angle in radians.
24+
/// </returns>
25+
///
26+
/// <remarks>
27+
/// This method is useful for converting angles from the more commonly used degrees
28+
/// measurement to radians, which is often required by trigonometric functions.
29+
/// </remarks>
30+
///
31+
/// <example>
32+
/// The example below will convert 45 degrees to radians and then print the result.
33+
///
34+
/// <code>
35+
/// // Convert 45 degrees to radians
36+
/// float degrees = 45f;
37+
/// float radians = MathHelper.DegreesToRadians(degrees);
38+
///
39+
/// Console.WriteLine($"45 degrees in radians is {radians}");
40+
/// </code>
41+
/// </example>
1142
public static float DegreesToRadians(float angle)
1243
{
1344
return (float)Math.PI / 180.0f * angle;
1445
}
1546

47+
/// <summary>
48+
/// Converts the specified <paramref name="angle"/> from radians to degrees.
49+
/// </summary>
50+
///
51+
/// <param name="angle">
52+
/// The angle in radians.
53+
/// </param>
54+
///
55+
/// <returns>
56+
/// The equivalent angle in degrees.
57+
/// </returns>
58+
///
59+
/// <remarks>
60+
/// This method is useful for converting angles from radians back to degrees,
61+
/// which can be more intuitive for human interpretation.
62+
/// </remarks>
63+
///
64+
/// <example>
65+
/// The below example will convert π/4 from radians to degrees.
66+
///
67+
/// <code>
68+
/// float radians = Math.PI / 4f;
69+
/// float degrees = MathHelper.RadiansToDegrees(radians);
70+
///
71+
/// Console.WriteLine($"π/4 radians in degrees is {degrees}");
72+
/// </code>
73+
/// </example>
1674
public static float RadiansToDegrees(float angle)
1775
{
1876
return 180.0f / (float)Math.PI * angle;

FinalEngine.Resources/Exceptions/ResourceLoaderNotRegisteredException.cs

+30
Original file line numberDiff line numberDiff line change
@@ -6,19 +6,49 @@ namespace FinalEngine.Resources.Exceptions;
66

77
using System;
88

9+
/// <summary>
10+
/// Represents an exception that is thrown when a <see cref="ResourceLoaderBase{TResource}"/> has not been registered to an <see cref="IResourceManager"/>.
11+
/// </summary>
12+
///
13+
/// <remarks>
14+
/// To register a <see cref="ResourceLoaderBase{TResource}"/> to an <see cref="IResourceManager"/> you should invoke the <see cref="IResourceManager.RegisterLoader{T}(ResourceLoaderBase{T})"/> function.
15+
/// </remarks>
16+
///
17+
/// <seealso cref="Exception" />
918
[Serializable]
1019
public class ResourceLoaderNotRegisteredException : Exception
1120
{
21+
/// <summary>
22+
/// Initializes a new instance of the <see cref="ResourceLoaderNotRegisteredException"/> class.
23+
/// </summary>
1224
public ResourceLoaderNotRegisteredException()
1325
: base("Resource Loader not registered.")
1426
{
1527
}
1628

29+
/// <summary>
30+
/// Initializes a new instance of the <see cref="ResourceLoaderNotRegisteredException"/> class.
31+
/// </summary>
32+
///
33+
/// <param name="message">
34+
/// The message that describes the error.
35+
/// </param>
1736
public ResourceLoaderNotRegisteredException(string? message)
1837
: base(message)
1938
{
2039
}
2140

41+
/// <summary>
42+
/// Initializes a new instance of the <see cref="ResourceLoaderNotRegisteredException"/> class.
43+
/// </summary>
44+
///
45+
/// <param name="message">
46+
/// The error message that explains the reason for the exception.
47+
/// </param>
48+
///
49+
/// <param name="innerException">
50+
/// The exception that is the cause of the current exception, or a <c>null</c> reference if no inner exception is specified.
51+
/// </param>
2252
public ResourceLoaderNotRegisteredException(string? message, Exception? innerException)
2353
: base(message, innerException)
2454
{

FinalEngine.Resources/FinalEngine.Resources.csproj

-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
<PropertyGroup>
44
<TargetFramework>net8.0</TargetFramework>
5-
<NoWarn>SA0001</NoWarn>
65
<Nullable>enable</Nullable>
76
<AnalysisMode>All</AnalysisMode>
87
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>

FinalEngine.Resources/IResource.cs

+7
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,13 @@ namespace FinalEngine.Resources;
66

77
using System.Diagnostics.CodeAnalysis;
88

9+
/// <summary>
10+
/// Defines an interface that represents a resource that can loaded via an <see cref="IResourceManager"/>.
11+
/// </summary>
12+
///
13+
/// <remarks>
14+
/// You should implement <see cref="IResource"/> on an <c>object</c> that should be managed by an <see cref="IResourceManager"/>.
15+
/// </remarks>
916
[SuppressMessage("Design", "CA1040:Avoid empty interfaces", Justification = "Required for Resource Manager.")]
1017
public interface IResource
1118
{

FinalEngine.Resources/IResourceManager.cs

+51-1
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,64 @@
55
namespace FinalEngine.Resources;
66

77
using System;
8+
using FinalEngine.Resources.Exceptions;
89

10+
/// <summary>
11+
/// Defines an interface that represents a resource manager.
12+
/// </summary>
13+
///
14+
/// <remarks>
15+
/// In almost all scenarios you should never have to implement this interface; if you require management of resources you should use the standard <see cref="ResourceManager"/> implementation.
16+
/// </remarks>
17+
///
18+
/// <seealso cref="System.IDisposable" />
919
public interface IResourceManager : IDisposable
1020
{
21+
/// <summary>
22+
/// Loads a resource at the specified <paramref name="filePath"/>.
23+
/// </summary>
24+
/// <typeparam name="T">
25+
/// The type of resource to load.
26+
/// </typeparam>
27+
///
28+
/// <param name="filePath">
29+
/// The file path of the resource to load.
30+
/// </param>
31+
///
32+
/// <remarks>
33+
/// The typical implementation of <see cref="IResourceManager"/> should attempt to cache resources; this way if <see cref="LoadResource{T}(string)"/> is called for the same file a reference the already loaded resource can be fetched.
34+
/// </remarks>
35+
///
36+
/// <returns>
37+
/// The loaded resource, of type <typeparamref name="T"/>.
38+
/// </returns>
1139
T LoadResource<T>(string filePath)
1240
where T : IResource;
1341

42+
/// <summary>
43+
/// Registers the specified <paramref name="loader"/> to this <see cref="IResourceManager"/>.
44+
/// </summary>
45+
///
46+
/// <typeparam name="T">
47+
/// The type of resource that can be loaded.
48+
/// </typeparam>
49+
///
50+
/// <param name="loader">
51+
/// The resource loader to be used when attempting to resolve a resource of type <typeparamref name="T"/>.
52+
/// </param>
53+
///
54+
/// <remarks>
55+
/// The typical implementation of an <see cref="IResourceManager"/> should likely throw a <see cref="ResourceLoaderNotRegisteredException"/> if a loader of the specified <typeparamref name="T"/> type has already been registered.
56+
/// </remarks>
1457
void RegisterLoader<T>(ResourceLoaderBase<T> loader)
1558
where T : IResource;
1659

17-
void UnloadResource(IResource? resource);
60+
/// <summary>
61+
/// Unloads the specified <paramref name="resource"/> from this <see cref="IResourceManager"/> (calling it's dispose method if <see cref="IDisposable"/> is implemented and there are no references).
62+
/// </summary>
63+
///
64+
/// <param name="resource">
65+
/// The resource to unload.
66+
/// </param>
67+
void UnloadResource(IResource resource);
1868
}

0 commit comments

Comments
 (0)