1.0.12 & 1.0.12.1
+ Utility Methods for texture transformations ~ Fixed an issue, where the horizontal & vertical flip was wrongly applied ~ Added missing summaries
This commit is contained in:
parent
a29a2cab53
commit
f11a954b5a
10 changed files with 116 additions and 21 deletions
|
|
@ -23,6 +23,10 @@ namespace SM2D.Drawing
|
|||
Transform.Size = new CVector2(1);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sets the height of the text.
|
||||
/// </summary>
|
||||
/// <param name="desiredHeight">The height it should be.</param>
|
||||
public void SetHeight(float desiredHeight)
|
||||
{
|
||||
if (!Font.WasCompiled) Font.Compile();
|
||||
|
|
|
|||
|
|
@ -54,9 +54,7 @@ namespace SM2D.Types
|
|||
{
|
||||
float z = 1 / (float) ZIndexPercision * ZIndex;
|
||||
|
||||
return Matrix4.CreateScale(Size.X, Size.Y, 1) *
|
||||
Matrix4.CreateRotationX(MathHelper.DegreesToRadians(HorizontalFlip ? 180 : 0)) *
|
||||
Matrix4.CreateRotationY(MathHelper.DegreesToRadians(VerticalFlip ? 180 : 0)) *
|
||||
return Matrix4.CreateScale(Size.X * (VerticalFlip ? -1 : 1), Size.Y * (HorizontalFlip ? -1 : 1), 1) *
|
||||
Matrix4.CreateRotationZ(MathHelper.DegreesToRadians(Rotation)) *
|
||||
Matrix4.CreateTranslation(Position.X, Position.Y, z);
|
||||
}
|
||||
|
|
@ -100,5 +98,15 @@ namespace SM2D.Types
|
|||
{
|
||||
Size.Set(width, width / texture.Aspect);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Adjusts <see cref="Size"/> for the texture transform.
|
||||
/// <para>In this way you can make sure, the texture is not stretched.</para>
|
||||
/// </summary>
|
||||
/// <param name="transform"></param>
|
||||
public void AdjustSizeToTextureTransform(TextureTransformation transform)
|
||||
{
|
||||
Size.Set(transform.Scale * Size);
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue