using System; using System.Numerics; using Microsoft.Xna.Framework.Graphics; using MonoGameBlank2dStartKit.Core.Content; using MonoGameBlank2dStartKit.Core.Utils; namespace MonoGameBlank2dStartKit.Core; public readonly record struct Position(Vector2 Vector2) { public Position(float x, float y) : this(new Vector2(x, y)) { } } public readonly record struct Velocity(Vector2 Vector2) { public Velocity(float x, float y) : this(new Vector2(x, y)) { } } public readonly record struct Mass(int Value); public readonly record struct RotationSpeed(float Speed, float Amount = float.MaxValue, float Drag = 0) { public RotationSpeed(float speed, TimeSpan timeSpan) : this(speed, speed * timeSpan.SecFloat()) { } } public readonly record struct Rotation(float Value, Vector2 Origin) { public Rotation(float value, Texture2D texture) : this(value, CenterOfTexture(texture)) { } private static Vector2 CenterOfTexture(Texture2D texture) { return new Vector2((float) texture.Width / 2, (float) texture.Height / 2); } } public readonly record struct Image(ImageId ImageId); public interface IMovement { Position Start { get; init; } Position Target { get; init; } float DurationSec { get; init; } float ProgressSec { get; init; } } public readonly record struct MoveLinearly( Position Start, Position Target, float DurationSec, float ProgressSec = 0f ) : IMovement; public readonly record struct CubicEaseIn( Position Start, Position Target, float DurationSec, float ProgressSec = 0f ) : IMovement; public readonly record struct CubicEaseOut( Position Start, Position Target, float DurationSec, float ProgressSec = 0f ) : IMovement; public readonly record struct CubicEaseInOut( Position Start, Position Target, float DurationSec, float ProgressSec = 0f ) : IMovement; public readonly record struct QuinticEaseIn( Position Start, Position Target, float DurationSec, float ProgressSec = 0f ) : IMovement; public readonly record struct QuinticEaseOut( Position Start, Position Target, float DurationSec, float ProgressSec = 0f ) : IMovement; public readonly record struct AddEntityOnStop();