diff --git a/Engine.Core/Abstract/IBehaviour.cs b/Engine.Core/Abstract/IBehaviour.cs index 95d12d8..f113694 100644 --- a/Engine.Core/Abstract/IBehaviour.cs +++ b/Engine.Core/Abstract/IBehaviour.cs @@ -3,22 +3,22 @@ using System; namespace Syntriax.Engine.Core.Abstract; /// -/// Responsible for every behaviour an object in the game might have, controlled by . +/// Represents a behaviour that any object in the game might use to interact with itself or other objects. /// public interface IBehaviour : IEntity, IAssignableBehaviourController, IAssignableStateEnable, IInitialize { /// - /// Callback triggered when the has changed. + /// Event triggered when the priority of the changes. /// Action? OnPriorityChanged { get; set; } /// - /// Call priority of the . + /// The priority of the . /// int Priority { get; set; } /// - /// If the is active. + /// The value indicating whether the is active. /// bool IsActive { get; } } diff --git a/Engine.Core/Abstract/IBehaviourController.cs b/Engine.Core/Abstract/IBehaviourController.cs index ddef1ca..a9c560a 100644 --- a/Engine.Core/Abstract/IBehaviourController.cs +++ b/Engine.Core/Abstract/IBehaviourController.cs @@ -5,102 +5,101 @@ using System.Diagnostics.CodeAnalysis; namespace Syntriax.Engine.Core.Abstract; /// -/// Responsible for controlling s and notify them accordingly about the engine's updates. Connected to an . +/// Represents a controller for managing s and notify them accordingly about the engine's updates. Connected to an . /// public interface IBehaviourController : IAssignableGameObject, IEnumerable { /// - /// Callback triggered when the is called but right before the action is triggered. + /// Event triggered before the update of s. /// Action? OnPreUpdate { get; set; } + /// - /// Callback triggered when the is called. + /// Event triggered during the update of s. /// Action? OnUpdate { get; set; } /// - /// Callback triggered when the is called. + /// Event triggered before the drawing phase. /// Action? OnPreDraw { get; set; } - /// - /// Callback triggered when the has been registered a new . + /// Event triggered when a is added to the . /// Action? OnBehaviourAdded { get; set; } /// - /// Callback triggered when the has been removed an existing . + /// Event triggered when a is removed from the . /// Action? OnBehaviourRemoved { get; set; } - /// - /// Registers the provided to be controlled by the . + /// Adds a to the . /// - /// Uninitialized to be registered. - /// An implemented class of - /// The provided class after initialization. + /// The type of to add. + /// The to add. + /// The added . T AddBehaviour(T behaviour) where T : class, IBehaviour; /// - /// Instantiates the provided type and registers it to the . + /// Adds a of the specified type to the . /// - /// Constructor parameters for the given class. - /// An implemented class of - /// The instantiated class after initialization. + /// The type of to add. + /// Construction parameters for the . + /// The added . T AddBehaviour(params object?[]? args) where T : class, IBehaviour; /// - /// Looks up and returns the that is controlled by the . + /// Gets a of the specified type. /// - /// An implemented class or - /// - /// , if the type of is present in the , if not. - /// + /// The type of to get. + /// The of the specified type if found; otherwise, . T? GetBehaviour(); /// - /// Looks up and tries to get the that is controlled by the . + /// Tries to get a of the specified type. /// - /// If return value is outputs the class found in the . If the return value is falls, this parameter is - /// An implemented class or - /// - /// , if the type of is present in the , if not. - /// + /// The type of to get. + /// When this method returns, contains the of the specified type, if found; otherwise, see. + /// if a of the specified type was found; otherwise, . bool TryGetBehaviour([NotNullWhen(returnValue: true)] out T? behaviour); - /// An implemented class or . - /// Returns a list of all the matching s found in the . + /// + /// Gets all s of the specified type. + /// + /// The type of s to get. + /// A list of s of the specified type. IList GetBehaviours(); - /// An implemented class or . - /// Fills the provided list parameter all the matching s found in the . + /// + /// Gets all s of the specified type and stores them in the provided list. + /// + /// The type of s to get. + /// The list to store the s. void GetBehaviours(List behaviours); /// - /// Removes the found in the . + /// Removes s of the specified type from the . /// - /// If all of the instances of the given Type is to be removed or not. - /// An implemented class or of + /// The type of s to remove. + /// A flag indicating whether to remove all s of the specified type. void RemoveBehaviour(bool removeAll = false) where T : class, IBehaviour; /// - /// Removes the found in the . + /// Removes the specified from the . /// - /// If all of the instances of the given Type is to be removed or not. - /// An implemented class or of + /// The type of to remove. + /// The to remove. void RemoveBehaviour(T behaviour) where T : class, IBehaviour; /// - /// To be called in every frame of the engine. Responsible for notifying 's under the 's control that a new frame is happening. + /// Updates all s in the . /// - /// information from the game. void Update(); /// - /// To be called before every draw call from the engine. Responsible for notifying 's under the 's control that the engine is about to start drawing into the screen. + /// Performs pre-draw operations. /// - /// information from the game. void UpdatePreDraw(); } diff --git a/Engine.Core/Abstract/ICamera2D.cs b/Engine.Core/Abstract/ICamera2D.cs index dc919ca..a70a7fa 100644 --- a/Engine.Core/Abstract/ICamera2D.cs +++ b/Engine.Core/Abstract/ICamera2D.cs @@ -1,9 +1,26 @@ namespace Syntriax.Engine.Core.Abstract; +/// +/// Represents a 2D camera in the engine. +/// public interface ICamera2D : IBehaviour, IAssignableTransform { + /// + /// The zoom level of the camera. + /// float Zoom { get; set; } + /// + /// Converts a position from screen coordinates to world coordinates. + /// + /// The position in screen coordinates. + /// The position in world coordinates. Vector2D ScreenToWorldPosition(Vector2D screenPosition); + + /// + /// Converts a position from world coordinates to screen coordinates. + /// + /// The position in world coordinates. + /// The position in screen coordinates. Vector2D WorldToScreenPosition(Vector2D worldPosition); } diff --git a/Engine.Core/Abstract/IEntity.cs b/Engine.Core/Abstract/IEntity.cs index d54ff83..e9532fe 100644 --- a/Engine.Core/Abstract/IEntity.cs +++ b/Engine.Core/Abstract/IEntity.cs @@ -1,5 +1,8 @@ namespace Syntriax.Engine.Core.Abstract; +/// +/// Represents a basic entity in the engine. +/// public interface IEntity : IInitialize, IAssignableStateEnable { } diff --git a/Engine.Core/Abstract/IGameManager.cs b/Engine.Core/Abstract/IGameManager.cs index e27dba8..35a2755 100644 --- a/Engine.Core/Abstract/IGameManager.cs +++ b/Engine.Core/Abstract/IGameManager.cs @@ -3,19 +3,55 @@ using System.Collections.Generic; namespace Syntriax.Engine.Core.Abstract; +/// +/// Represents a game world responsible for managing s. +/// public interface IGameManager : IEntity, IEnumerable { + /// + /// Event triggered when a is registered to the . + /// Action? OnGameObjectRegistered { get; set; } + + /// + /// Event triggered when a is unregistered from the . + /// Action? OnGameObjectUnRegistered { get; set; } - + /// + /// Gets a read-only list of s managed by the . + /// IReadOnlyList GameObjects { get; } - + /// + /// Registers a to the . + /// + /// The to register. void RegisterGameObject(IGameObject gameObject); + + /// + /// Instantiates a of type T with the given arguments and registers it to the . + /// + /// The type of to instantiate. + /// Constructor parameters for the given type of . + /// The instantiated . T InstantiateGameObject(params object?[]? args) where T : class, IGameObject; + + /// + /// Removes a from the . + /// + /// The to remove. + /// The removed . IGameObject RemoveGameObject(IGameObject gameObject); + /// + /// Updates the with the given engine time data. + /// + /// The engine time. void Update(EngineTime time); + + /// + /// Performs operations that should be done before the draw calls. + /// void PreDraw(); } diff --git a/Engine.Core/Abstract/IGameObject.cs b/Engine.Core/Abstract/IGameObject.cs index d625e88..f01de33 100644 --- a/Engine.Core/Abstract/IGameObject.cs +++ b/Engine.Core/Abstract/IGameObject.cs @@ -2,9 +2,18 @@ using System; namespace Syntriax.Engine.Core.Abstract; +/// +/// Represents a game object with various properties and functionalities. +/// public interface IGameObject : IEntity, IAssignableGameManager, IAssignableTransform, IAssignableBehaviourController, INameable, IInitialize { + /// + /// Event triggered when the method is called. + /// Action? OnUpdated { get; set; } + /// + /// Updates the game object. + /// void Update(); } diff --git a/Engine.Core/Abstract/IInitialize.cs b/Engine.Core/Abstract/IInitialize.cs index 91c1362..8ba8b26 100644 --- a/Engine.Core/Abstract/IInitialize.cs +++ b/Engine.Core/Abstract/IInitialize.cs @@ -2,12 +2,35 @@ using System; namespace Syntriax.Engine.Core.Abstract; +/// +/// Represents an entity that can be initialized and finalized. This information is useful for objects we know that are not in use and can be either recycled or dropped for garbage collection. +/// public interface IInitialize { + /// + /// Event triggered when the method is called successfully. + /// Action? OnInitialized { get; set; } + + /// + /// Event triggered when the method is called successfully. + /// Action? OnFinalized { get; set; } + + /// + /// The value indicating whether the entity has been initialized. + /// bool Initialized { get; } + /// + /// Initializes the entity. + /// + /// if initialization is successful, otherwise . bool Initialize(); + + /// + /// Finalizes the entity so it can either be recycled or garbage collected. + /// + /// if finalization is successful, otherwise . bool Finalize(); } diff --git a/Engine.Core/Abstract/INameable.cs b/Engine.Core/Abstract/INameable.cs index d7f8086..df585c5 100644 --- a/Engine.Core/Abstract/INameable.cs +++ b/Engine.Core/Abstract/INameable.cs @@ -2,8 +2,18 @@ using System; namespace Syntriax.Engine.Core.Abstract; +/// +/// Represents an entity with a name. +/// public interface INameable { + /// + /// Event triggered when the name of the entity changes. + /// Action? OnNameChanged { get; set; } + + /// + /// The name of the entity. + /// string Name { get; set; } } diff --git a/Engine.Core/Abstract/IStateEnable.cs b/Engine.Core/Abstract/IStateEnable.cs index d32cca2..cfa6f45 100644 --- a/Engine.Core/Abstract/IStateEnable.cs +++ b/Engine.Core/Abstract/IStateEnable.cs @@ -2,8 +2,18 @@ using System; namespace Syntriax.Engine.Core.Abstract; +/// +/// Represents an entity with an enable state that can be toggled. +/// public interface IStateEnable : IAssignableEntity { + /// + /// Event triggered when the state of the changes. + /// Action? OnEnabledChanged { get; set; } + + /// + /// The value indicating whether the is enabled. + /// bool Enabled { get; set; } } diff --git a/Engine.Core/Abstract/ITransform.cs b/Engine.Core/Abstract/ITransform.cs index 437b4d7..f97cc17 100644 --- a/Engine.Core/Abstract/ITransform.cs +++ b/Engine.Core/Abstract/ITransform.cs @@ -2,14 +2,38 @@ using System; namespace Syntriax.Engine.Core.Abstract; +/// +/// Represents the transformation properties of an object such as position, scale, and rotation. +/// public interface ITransform { + /// + /// Event triggered when the of the changes. + /// Action? OnPositionChanged { get; set; } + + /// + /// Event triggered when the of the changes. + /// Action? OnScaleChanged { get; set; } + + /// + /// Event triggered when the of the changes. + /// Action? OnRotationChanged { get; set; } + /// + /// The position of the in 2D space. + /// Vector2D Position { get; set; } + + /// + /// The scale of the . + /// Vector2D Scale { get; set; } + /// + /// The rotation of the in degrees. + /// float Rotation { get; set; } }