2024-01-23 18:39:25 +03:00
|
|
|
namespace Syntriax.Engine.Physics2D.Abstract;
|
|
|
|
|
2024-02-01 12:26:28 +03:00
|
|
|
/// <summary>
|
|
|
|
/// Represents a 2D physics engine.
|
|
|
|
/// </summary>
|
2024-01-23 18:39:25 +03:00
|
|
|
public interface IPhysicsEngine2D
|
|
|
|
{
|
2024-10-25 23:10:32 +03:00
|
|
|
/// <summary>
|
|
|
|
/// Event triggered when the <see cref="IPhysicsEngine2D"/> has done a single physics iteration.
|
|
|
|
/// </summary>
|
2024-11-23 23:14:44 +03:00
|
|
|
event OnPhysicsIterationEventHandler? OnPhysicsIteration;
|
2024-10-25 23:10:32 +03:00
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Event triggered when the <see cref="IPhysicsEngine2D"/> has done a full physics step/>.
|
|
|
|
/// </summary>
|
2024-11-23 23:14:44 +03:00
|
|
|
event OnPhysicsStepEventHandler? OnPhysicsStep;
|
2024-10-25 23:10:32 +03:00
|
|
|
|
2024-02-01 12:26:28 +03:00
|
|
|
/// <summary>
|
|
|
|
/// The number of iterations the <see cref="IPhysicsEngine2D"/> performs per step.
|
|
|
|
/// </summary>
|
2024-02-01 12:34:06 +03:00
|
|
|
int IterationPerStep { get; set; }
|
2024-01-23 18:39:25 +03:00
|
|
|
|
2024-02-01 12:26:28 +03:00
|
|
|
/// <summary>
|
|
|
|
/// Advances the physics simulation by the specified time.
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="deltaTime">The time step.</param>
|
2024-01-23 18:39:25 +03:00
|
|
|
void Step(float deltaTime);
|
2024-10-25 23:10:32 +03:00
|
|
|
|
2024-11-23 23:14:44 +03:00
|
|
|
delegate void OnPhysicsIterationEventHandler(IPhysicsEngine2D sender, float iterationDeltaTime);
|
|
|
|
delegate void OnPhysicsStepEventHandler(IPhysicsEngine2D sender, float stepDeltaTime);
|
2024-01-23 18:39:25 +03:00
|
|
|
}
|