From d4e8ccb06b1368589aa3236cc52ccc2d726f6a6e Mon Sep 17 00:00:00 2001 From: Ronen Date: Wed, 1 Nov 2023 10:52:01 +0200 Subject: [PATCH] added rotation to paragraph --- GeonBit.UI.nuspec | 2 +- GeonBit.UI/Source/Entities/Paragraph.cs | 19 ++++++++++++------- GeonBit.UI/Source/UserInterface.cs | 2 +- README.md | 4 ++++ 4 files changed, 18 insertions(+), 9 deletions(-) diff --git a/GeonBit.UI.nuspec b/GeonBit.UI.nuspec index 53ce8c0..37d0ab5 100644 --- a/GeonBit.UI.nuspec +++ b/GeonBit.UI.nuspec @@ -2,7 +2,7 @@ GeonBit.UI - 4.3.0.0 + 4.3.0.1 Ronen Ness RonenNess MonoGame GeonBit.UI diff --git a/GeonBit.UI/Source/Entities/Paragraph.cs b/GeonBit.UI/Source/Entities/Paragraph.cs index 0154f84..8e903bf 100644 --- a/GeonBit.UI/Source/Entities/Paragraph.cs +++ b/GeonBit.UI/Source/Entities/Paragraph.cs @@ -70,6 +70,11 @@ static Paragraph() /// public Point BackgroundColorOffset = new Point(0, 0); + /// + /// Rotate the paragraph. + /// + public float Rotation; + /// /// An optional font you can set to override the default fonts. /// NOTE! Only monospace fonts are supported! @@ -595,7 +600,7 @@ override protected void DrawEntity(SpriteBatch spriteBatch, DrawPhase phase) // draw text itself spriteBatch.DrawString(_currFont, _processedText, _position, fillCol, - 0, _fontOrigin, _actualScale, SpriteEffects.None, 0.5f); + Rotation, _fontOrigin, _actualScale, SpriteEffects.None, 0.5f); // call base draw function base.DrawEntity(spriteBatch, phase); @@ -630,21 +635,21 @@ protected void DrawTextOutline(SpriteBatch spriteBatch, string text, int outline if (outlineWidth <= MaxOutlineWidthToOptimize) { spriteBatch.DrawString(font, text, position + Vector2.One * outlineWidth, outlineColor, - 0, origin, scale, SpriteEffects.None, 0.5f); + Rotation, origin, scale, SpriteEffects.None, 0.5f); spriteBatch.DrawString(font, text, position - Vector2.One * outlineWidth, outlineColor, - 0, origin, scale, SpriteEffects.None, 0.5f); + Rotation, origin, scale, SpriteEffects.None, 0.5f); } // for really thick outline we need to cover the other corners as well else { spriteBatch.DrawString(font, text, position + Vector2.UnitX * outlineWidth, outlineColor, - 0, origin, scale, SpriteEffects.None, 0.5f); + Rotation, origin, scale, SpriteEffects.None, 0.5f); spriteBatch.DrawString(font, text, position - Vector2.UnitX * outlineWidth, outlineColor, - 0, origin, scale, SpriteEffects.None, 0.5f); + Rotation, origin, scale, SpriteEffects.None, 0.5f); spriteBatch.DrawString(font, text, position + Vector2.UnitY * outlineWidth, outlineColor, - 0, origin, scale, SpriteEffects.None, 0.5f); + Rotation, origin, scale, SpriteEffects.None, 0.5f); spriteBatch.DrawString(font, text, position - Vector2.UnitY * outlineWidth, outlineColor, - 0, origin, scale, SpriteEffects.None, 0.5f); + Rotation, origin, scale, SpriteEffects.None, 0.5f); } } } diff --git a/GeonBit.UI/Source/UserInterface.cs b/GeonBit.UI/Source/UserInterface.cs index 9d48f3e..570d42c 100644 --- a/GeonBit.UI/Source/UserInterface.cs +++ b/GeonBit.UI/Source/UserInterface.cs @@ -94,7 +94,7 @@ public enum BuiltinThemes public class UserInterface : System.IDisposable { /// Current GeonBit.UI version identifier. - public const string VERSION = "4.3.0.0"; + public const string VERSION = "4.3.0.1"; /// /// The currently active user interface instance. diff --git a/README.md b/README.md index c4ea8fa..ae51ef9 100644 --- a/README.md +++ b/README.md @@ -2098,6 +2098,10 @@ If you want to use the new files dialog, you must include the new textures that - Fixed files dialog to show folders if can pick them, even if can't change root folder. - Fixed background offset bug in selected list item with icon. +### 4.3.0.1 + +- Added rotation to paragraphs. + ## Credits GeonBit.UI was written by Ronen Ness, but uses some free textures made by awesome people who share their work for free.