Size StructureDelta Engine Documentation
Holds the width and height of an object (e.g. a rectangle). View code on GitHub

Namespace: DeltaEngine.Datatypes
Assembly: DeltaEngine (in DeltaEngine.dll) Version: 1.1.1.0 (1.1.1)
Syntax

public struct Size : IEquatable<Size>, 
	Lerp<Size>, Lerp

The Size type exposes the following members.

Constructors

  NameDescription
Public methodSize(Single)
Initializes a new instance of the Size class
Public methodSize(String)
Initializes a new instance of the Size class
Public methodSize(Single, Single)
Initializes a new instance of the Size class
Top
Methods

  NameDescription
Public methodEquals(Object) (Overrides ValueType Equals(Object).)
Public methodEquals(Size)
Public methodGetHashCode (Overrides ValueType GetHashCode .)
Public methodIsNearlyEqual
Public methodLerp
Public methodToString (Overrides ValueType ToString .)
Top
Operators

  NameDescription
Public operatorStatic memberAddition
Public operatorStatic memberDivision(Single, Size)
Public operatorStatic memberDivision(Size, Size)
Public operatorStatic memberDivision(Size, Single)
Public operatorStatic memberEquality
Public operatorStatic member (Vector2D to Size)
Public operatorStatic memberInequality
Public operatorStatic memberMultiply(Single, Size)
Public operatorStatic memberMultiply(Size, Size)
Public operatorStatic memberMultiply(Size, Single)
Public operatorStatic memberSubtraction
Top
Fields

  NameDescription
Public fieldStatic memberHalf
Public fieldStatic memberOne
Public fieldStatic memberSizeInBytes
Public fieldStatic memberUnused
Public fieldStatic memberZero
Top
Properties

  NameDescription
Public propertyAspectRatio
Public propertyHeight
Public propertyLength
Public propertyWidth
Top
Remarks

Tests: DeltaEngine.Tests.Datatypes.SizeTests
Examples

23 unit tests call DeltaEngine.Datatypes.Size
[Test]
public void StaticSizes()
{
    Assert.AreEqual(new Size(), Size.Zero);
    Assert.AreEqual(new Size(0.0f, 0.0f), Size.Zero);
    Assert.AreEqual(new Size(0.5f, 0.5f), Size.Half);
    Assert.AreEqual(new Size(1.0f, 1.0f), Size.One);
    Assert.AreEqual(new Size(-1.0f, -1.0f), Size.Unused);
    Assert.AreEqual(8, Size.SizeInBytes);
}
[Test]
public void CreateWithEqualWidthAndHeight()
{
    var size = new Size(-1.2f);
    Assert.AreEqual(-1.2f, size.Width);
    Assert.AreEqual(-1.2f, size.Height);
}
[Test]
public void CreateFromString()
{
    var size = new Size("1.2, 2.4");
    Assert.AreEqual(1.2f, size.Width);
    Assert.AreEqual(2.4f, size.Height);
}
See Also