|
12 | 12 |
|
13 | 13 | namespace MonoGame.Aseprite.Utils;
|
14 | 14 |
|
15 |
| -internal static class AsepriteDotNetExtensions |
| 15 | +/// <summary> |
| 16 | +/// Defines extension methods for translating between AsepriteDotNet types to MonoGame types. |
| 17 | +/// </summary> |
| 18 | +public static class AsepriteDotNetExtensions |
16 | 19 | {
|
17 |
| - internal static Texture2D ToTexture2D(this AseTexture texture, GraphicsDevice device) |
| 20 | + /// <summary> |
| 21 | + /// Converts an AsepriteDotNet Texture to a MonoGame Texture2D object. |
| 22 | + /// </summary> |
| 23 | + /// <param name="texture">The AsepriteDotNet texture to convert.</param> |
| 24 | + /// <param name="device">The graphics device used to create graphical resources.</param> |
| 25 | + /// <returns>The converted MonoGame Texture2D object.</returns> |
| 26 | + public static Texture2D ToTexture2D(this AseTexture texture, GraphicsDevice device) |
18 | 27 | {
|
19 | 28 | Texture2D texture2D = new Texture2D(device, texture.Size.Width, texture.Size.Height);
|
20 | 29 | texture2D.Name = texture.Name;
|
21 | 30 | texture2D.SetData(texture.Pixels.ToArray());
|
22 | 31 | return texture2D;
|
23 | 32 | }
|
24 | 33 |
|
25 |
| - internal unsafe static Color ToXnaColor(this AseColor color) => Unsafe.As<AseColor, Color>(ref color); |
| 34 | + /// <summary> |
| 35 | + /// Converts an AsepriteDotNet color to a MonoGame Color object. |
| 36 | + /// </summary> |
| 37 | + /// <param name="color">The AsepriteDotNet color to convert.</param> |
| 38 | + /// <returns>The converted MonoGame Color object.</returns> |
| 39 | + public unsafe static Color ToXnaColor(this AseColor color) => Unsafe.As<AseColor, Color>(ref color); |
26 | 40 |
|
27 |
| - internal static Point ToXnaPoint(this AsePoint point) => new Point(point.X, point.Y); |
| 41 | + /// <summary> |
| 42 | + /// Converts an AsepriteDotNet point to a MonoGame Point object. |
| 43 | + /// </summary> |
| 44 | + /// <param name="point">The AsepriteDotNet point to convert.</param> |
| 45 | + /// <returns>The converted MonoGame Point object.</returns> |
| 46 | + public static Point ToXnaPoint(this AsePoint point) => new Point(point.X, point.Y); |
28 | 47 |
|
29 |
| - internal static Vector2 ToXnaVector2(this AsePoint point) => new Vector2(point.X, point.Y); |
30 |
| - internal static Rectangle ToXnaRectangle(this AseRectangle rect) => new Rectangle(rect.X, rect.Y, rect.Width, rect.Height); |
| 48 | + /// <summary> |
| 49 | + /// Converts an AsepriteDotNet point to a MonoGame Vector2 object. |
| 50 | + /// </summary> |
| 51 | + /// <param name="point">The AsepriteDotNet point to convert.</param> |
| 52 | + /// <returns>The converted MonoGame Vector2 object.</returns> |
| 53 | + public static Vector2 ToXnaVector2(this AsePoint point) => new Vector2(point.X, point.Y); |
| 54 | + |
| 55 | + /// <summary> |
| 56 | + /// Converts an AsepriteDotNet rectangle to a MonoGame Rectangle object. |
| 57 | + /// </summary> |
| 58 | + /// <param name="rect">The AsepriteDotNet rectangle to convert.</param> |
| 59 | + /// <returns>The converted MonoGame Rectangle object.</returns> |
| 60 | + public static Rectangle ToXnaRectangle(this AseRectangle rect) => new Rectangle(rect.X, rect.Y, rect.Width, rect.Height); |
31 | 61 | }
|
0 commit comments