Skip to content

Commit

Permalink
added rotation to paragraph
Browse files Browse the repository at this point in the history
  • Loading branch information
RonenNess committed Nov 1, 2023
1 parent 7d0d6a4 commit d4e8ccb
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 9 deletions.
2 changes: 1 addition & 1 deletion GeonBit.UI.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<package xmlns="http://schemas.microsoft.com/packaging/2013/05/nuspec.xsd">
<metadata>
<id>GeonBit.UI</id>
<version>4.3.0.0</version>
<version>4.3.0.1</version>
<authors>Ronen Ness</authors>
<owners>RonenNess</owners>
<title>MonoGame GeonBit.UI</title>
Expand Down
19 changes: 12 additions & 7 deletions GeonBit.UI/Source/Entities/Paragraph.cs
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,11 @@ static Paragraph()
/// </summary>
public Point BackgroundColorOffset = new Point(0, 0);

/// <summary>
/// Rotate the paragraph.
/// </summary>
public float Rotation;

/// <summary>
/// An optional font you can set to override the default fonts.
/// NOTE! Only monospace fonts are supported!
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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);
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion GeonBit.UI/Source/UserInterface.cs
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ public enum BuiltinThemes
public class UserInterface : System.IDisposable
{
/// <summary>Current GeonBit.UI version identifier.</summary>
public const string VERSION = "4.3.0.0";
public const string VERSION = "4.3.0.1";

/// <summary>
/// The currently active user interface instance.
Expand Down
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit d4e8ccb

Please sign in to comment.