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

View file

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