Remove obsolete project files for MrGameEng.AI, MrGameEng.Assets, MrGameEng.Atlases, and MrGameEng.Collisions modules. Introduce new AssetManager and related classes for asset loading and management, including support for texture atlases and mod definitions. Enhance mod loading capabilities with DefDatabase and LanguageManager for JSON-based definitions and localization. Implement a shelf packing algorithm for efficient texture atlas creation.

This commit is contained in:
Leonid Pershin
2026-06-12 07:47:04 +03:00
parent 1f87fb0b74
commit c30e2ce764
70 changed files with 0 additions and 233 deletions
@@ -0,0 +1,63 @@
using Friflo.Engine.ECS;
using Microsoft.Xna.Framework;
namespace MrGameEng.Collisions;
/// <summary>Shape of a <see cref="Collider"/>.</summary>
public enum ColliderShape : byte
{
/// <summary>Circle of <see cref="Collider.Radius"/>.</summary>
Circle,
/// <summary>Axis-aligned box of <see cref="Collider.HalfExtents"/>. Does not rotate with the entity.</summary>
Box,
}
/// <summary>
/// Collision shape component. Create via <see cref="Circle"/> or <see cref="Box"/> —
/// the struct default has no size and collides with nothing.
/// Positions come from <c>Transform2D</c>; <see cref="Offset"/> shifts the shape
/// relative to it (entity scale and rotation are not applied to collider shapes).
/// </summary>
public struct Collider : IComponent
{
/// <summary>Shape kind.</summary>
public ColliderShape Shape;
/// <summary>Circle radius in world units (<see cref="ColliderShape.Circle"/> only).</summary>
public float Radius;
/// <summary>Half extents of the box (<see cref="ColliderShape.Box"/> only).</summary>
public Vector2 HalfExtents;
/// <summary>Shape center offset from the entity's transform position.</summary>
public Vector2 Offset;
/// <summary>Bit mask of layers this collider belongs to.</summary>
public uint Layer;
/// <summary>Bit mask of layers this collider collides with. A pair is reported only when the masks agree both ways.</summary>
public uint CollidesWith;
/// <summary>Creates a circle collider on layer 1 colliding with everything.</summary>
public static Collider Circle(float radius, Vector2 offset = default) =>
new()
{
Shape = ColliderShape.Circle,
Radius = radius,
Offset = offset,
Layer = 1,
CollidesWith = uint.MaxValue,
};
/// <summary>Creates a box collider on layer 1 colliding with everything.</summary>
public static Collider Box(float width, float height, Vector2 offset = default) =>
new()
{
Shape = ColliderShape.Box,
HalfExtents = new Vector2(width / 2f, height / 2f),
Offset = offset,
Layer = 1,
CollidesWith = uint.MaxValue,
};
}