74 lines
2.9 KiB
C#

namespace Syntriax.Engine.Core.Abstract;
/// <summary>
/// Represents the transformation properties of an object such as position, scale, and rotation in 2D space.
/// </summary>
public interface ITransform2D : IBehaviour
{
/// <summary>
/// Event triggered when the <see cref="Position"/> of the <see cref="ITransform2D"/> changes.
/// </summary>
event OnPositionChangedEventHandler? OnPositionChanged;
/// <summary>
/// Event triggered when the <see cref="Scale"/> of the <see cref="ITransform2D"/> changes.
/// </summary>
event OnScaleChangedEventHandler? OnScaleChanged;
/// <summary>
/// Event triggered when the <see cref="Rotation"/> of the <see cref="ITransform"/> changes.
/// </summary>
event OnRotationChangedEventHandler? OnRotationChanged;
/// <summary>
/// The world position of the <see cref="ITransform2D"/> in 2D space.
/// </summary>
Vector2D Position { get; set; }
/// <summary>
/// The world scale of the <see cref="ITransform2D"/>.
/// </summary>
Vector2D Scale { get; set; }
/// <summary>
/// The world rotation of the <see cref="ITransform2D"/> in degrees.
/// </summary>
float Rotation { get; set; }
/// <summary>
/// The local position of the <see cref="ITransform2D"/> in 2D space.
/// </summary>
Vector2D LocalPosition { get; set; }
/// <summary>
/// The local scale of the <see cref="ITransform2D"/>.
/// </summary>
Vector2D LocalScale { get; set; }
/// <summary>
/// The local rotation of the <see cref="ITransform2D"/> in degrees.
/// </summary>
float LocalRotation { get; set; }
/// <summary>
/// Delegate for the event triggered when the <see cref="ITransform2D"/>'s rotation changes.
/// </summary>
/// <param name="sender">The <see cref="ITransform2D"/> that the parent has changed.</param>
/// <param name="previousPosition">The previous <see cref="Position"/> of the <see cref="ITransform2D"/>.</param>
delegate void OnPositionChangedEventHandler(ITransform2D sender, Vector2D previousPosition);
/// <summary>
/// Delegate for the event triggered when the <see cref="ITransform2D"/>'s rotation changes.
/// </summary>
/// <param name="sender">The <see cref="ITransform2D"/> that the parent has changed.</param>
/// <param name="previousScale">The previous <see cref="Scale"/> of the <see cref="ITransform2D"/>.</param>
delegate void OnScaleChangedEventHandler(ITransform2D sender, Vector2D previousScale);
/// <summary>
/// Delegate for the event triggered when the <see cref="ITransform2D"/>'s rotation changes.
/// </summary>
/// <param name="sender">The <see cref="ITransform2D"/> that the parent has changed.</param>
/// <param name="previousRotation">The previous <see cref="Rotation"/> of the <see cref="ITransform2D"/>.</param>
delegate void OnRotationChangedEventHandler(ITransform2D sender, float previousRotation);
}