1
0
Fork 0
mirror of https://github.com/Ellpeck/MLEM.git synced 2024-12-27 02:29:23 +01:00

made Padding and Direction2 DataContracts

This commit is contained in:
Ell 2021-02-28 16:42:51 +01:00
parent d73539e41e
commit 5b4757d3bf
2 changed files with 17 additions and 0 deletions

View file

@ -1,6 +1,7 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using Microsoft.Xna.Framework;
namespace MLEM.Misc {
@ -10,45 +11,55 @@ namespace MLEM.Misc {
/// There are several extension methods and arrays available in <see cref="Direction2Helper"/>.
/// </summary>
[Flags]
[DataContract]
public enum Direction2 {
/// <summary>
/// No direction.
/// </summary>
[EnumMember]
None = 0,
/// <summary>
/// The up direction, or -y.
/// </summary>
[EnumMember]
Up = 1,
/// <summary>
/// The right direction, or +x.
/// </summary>
[EnumMember]
Right = 2,
/// <summary>
/// The down direction, or +y.
/// </summary>
[EnumMember]
Down = 4,
/// <summary>
/// The left direction, or -x.
/// </summary>
[EnumMember]
Left = 8,
/// <summary>
/// The up and right direction, or +x, -y.
/// </summary>
[EnumMember]
UpRight = Up | Right,
/// <summary>
/// The down and right direction, or +x, +y.
/// </summary>
[EnumMember]
DownRight = Down | Right,
/// <summary>
/// The up and left direction, or -x, -y.
/// </summary>
[EnumMember]
UpLeft = Up | Left,
/// <summary>
/// The down and left direction, or -x, +y.
/// </summary>
[EnumMember]
DownLeft = Down | Left
}

View file

@ -1,3 +1,4 @@
using System.Runtime.Serialization;
using Microsoft.Xna.Framework;
namespace MLEM.Misc {
@ -5,23 +6,28 @@ namespace MLEM.Misc {
/// Represents a generic padding.
/// A padding is an object of data that stores an offset from each side of a rectangle or square.
/// </summary>
[DataContract]
public struct Padding {
/// <summary>
/// The amount of padding on the left side
/// </summary>
[DataMember]
public float Left;
/// <summary>
/// The amount of padding on the right side
/// </summary>
[DataMember]
public float Right;
/// <summary>
/// The amount of padding on the top side
/// </summary>
[DataMember]
public float Top;
/// <summary>
/// The amount of padding on the bottom side
/// </summary>
[DataMember]
public float Bottom;
/// <summary>
/// The total width of this padding, a sum of the left and right padding.