mirror of
https://github.com/Ellpeck/MLEM.git
synced 2024-11-24 13:38:34 +01:00
Compare commits
3 commits
e53d30e5ca
...
01bec459de
Author | SHA1 | Date | |
---|---|---|---|
01bec459de | |||
9eef1e5b1c | |||
bb9b322580 |
7 changed files with 24 additions and 35 deletions
|
@ -26,9 +26,11 @@ Additions
|
|||
|
||||
Improvements
|
||||
- Removed LINQ Any and All usage in various methods to improve memory usage
|
||||
- Explicitly disallow creating Paragraphs without fonts to make starting out with MLEM.Ui less confusing
|
||||
|
||||
Fixes
|
||||
- Fixed a crash if a paragraph has a link formatting code, but no font
|
||||
- Fixed tooltips with custom text scale not snapping to the mouse correctly in their first displayed frame
|
||||
|
||||
### MLEM.Extended
|
||||
Improvements
|
||||
|
|
|
@ -48,7 +48,10 @@ namespace Demos {
|
|||
RadioTexture = new NinePatch(new TextureRegion(this.testTexture, 16, 0, 8, 8), 3),
|
||||
RadioCheckmark = new TextureRegion(this.testTexture, 32, 0, 8, 8)
|
||||
};
|
||||
var untexturedStyle = new UntexturedStyle(this.SpriteBatch);
|
||||
var untexturedStyle = new UntexturedStyle(this.SpriteBatch) {
|
||||
TextScale = style.TextScale,
|
||||
Font = style.Font
|
||||
};
|
||||
// set the defined style as the current one
|
||||
this.UiSystem.Style = style;
|
||||
// scale every ui up by 5
|
||||
|
@ -73,7 +76,7 @@ namespace Demos {
|
|||
});
|
||||
|
||||
this.root.AddChild(new VerticalSpace(3));
|
||||
this.root.AddChild(new Paragraph(Anchor.AutoLeft, 1, "Note that the default style does not contain any textures or font files and, as such, is quite bland. However, the default style is quite easy to override, as can be seen in the code for this demo."));
|
||||
this.root.AddChild(new Paragraph(Anchor.AutoLeft, 1, "Note that the default style does not contain any textures and, as such, is quite bland. However, the default style is quite easy to override, as can be seen in the code for this demo."));
|
||||
this.root.AddChild(new Button(Anchor.AutoCenter, new Vector2(1, 10), "Change Style") {
|
||||
OnPressed = element => this.UiSystem.Style = this.UiSystem.Style == untexturedStyle ? style : untexturedStyle,
|
||||
PositionOffset = new Vector2(0, 1),
|
||||
|
@ -185,7 +188,7 @@ namespace Demos {
|
|||
CoroutineHandler.Start(WobbleProgressBar(bar2));
|
||||
var bar3 = this.root.AddChild(new ProgressBar(Anchor.AutoLeft, new Vector2(8, 30), Direction2.Down, 10) {PositionOffset = new Vector2(0, 1)});
|
||||
CoroutineHandler.Start(WobbleProgressBar(bar3));
|
||||
var bar4 = this.root.AddChild(new ProgressBar(Anchor.AutoInline, new Vector2(8, 30), Direction2.Up, 10) {PositionOffset = new Vector2(1, 1)});
|
||||
var bar4 = this.root.AddChild(new ProgressBar(Anchor.AutoInline, new Vector2(8, 30), Direction2.Up, 10) {PositionOffset = new Vector2(1, 0)});
|
||||
CoroutineHandler.Start(WobbleProgressBar(bar4));
|
||||
|
||||
this.root.AddChild(new VerticalSpace(3));
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
<img src="../Media/Logo.svg" width="25%" >
|
||||
<img src="../Media/Logo.svg" width="25%" alt="The MLEM logo">
|
||||
|
||||
**MLEM Library for Extending MonoGame** is an addition to the game framework [MonoGame](https://www.monogame.net/) that provides extension methods, quality of life improvements and additional features like a ui system and easy input handling.
|
||||
|
||||
|
@ -20,16 +20,17 @@ If you created a game with the help of MLEM, you can get it added to this list b
|
|||
# Gallery
|
||||
Here are some images that show a couple of MLEM's features.
|
||||
|
||||
MLEM.Ui in action:
|
||||
<img src="../Media/Ui.gif">
|
||||
The [MLEM.Ui](https://mlem.ellpeck.de/articles/ui) demo in action:
|
||||
|
||||
MLEM's text formatting system:
|
||||
<img src="../Media/Formatting.png">
|
||||
<img src="../Media/Ui.gif" alt="A gif showing various user interface elements from the MLEM.Ui demo">
|
||||
|
||||
MLEM's [text formatting system](https://mlem.ellpeck.de/articles/text_formatting), which is compatible with both MLEM.Ui and regular sprite batch rendering:
|
||||
|
||||
<img src="../Media/Formatting.png" alt="An image showing text with various colors and other formatting">
|
||||
|
||||
# Friends of MLEM
|
||||
There are several other NuGet packages and tools that work well in combination with MonoGame and MLEM. Here are some of them:
|
||||
- [Contentless](https://github.com/Ellpeck/Contentless), a tool that removes the need to add assets to the MonoGame Content Pipeline manually
|
||||
- [GameBundle](https://github.com/Ellpeck/GameBundle), a tool that packages MonoGame and other .NET Core applications into several distributable formats
|
||||
- [ButlerDotNet](https://github.com/Ellpeck/ButlerDotNet), a tool that automatically downloads and invokes itch.io's butler
|
||||
- [MonoGame.Extended](https://github.com/craftworkgames/MonoGame.Extended), a package that also provides several additional features for MonoGame
|
||||
- [Coroutine](https://github.com/Ellpeck/Coroutine), a package that implements Unity-style coroutines for any project
|
|
@ -151,8 +151,8 @@ namespace MLEM.Ui.Elements {
|
|||
/// <inheritdoc />
|
||||
protected override void InitStyle(UiStyle style) {
|
||||
base.InitStyle(style);
|
||||
this.RegularFont.SetFromStyle(style.Font ?? throw new NotSupportedException("Paragraphs cannot use ui styles that don't have a font. Please supply a custom font by setting UiStyle.Font."));
|
||||
this.TextScale.SetFromStyle(style.TextScale);
|
||||
this.RegularFont.SetFromStyle(style.Font);
|
||||
this.TextColor.SetFromStyle(style.TextColor);
|
||||
}
|
||||
|
||||
|
|
|
@ -67,6 +67,7 @@ namespace MLEM.Ui.Elements {
|
|||
if (this.Parent != null)
|
||||
throw new NotSupportedException($"A tooltip shouldn't be the child of another element ({this.Parent})");
|
||||
base.ForceUpdateArea();
|
||||
this.SnapPositionToMouse();
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
|
|
|
@ -37,25 +37,6 @@ namespace MLEM.Ui.Style {
|
|||
this.ProgressBarColor = Color.White;
|
||||
this.ProgressBarProgressPadding = new Vector2(1);
|
||||
this.ProgressBarProgressColor = Color.Red;
|
||||
this.Font = new EmptyFont();
|
||||
}
|
||||
|
||||
private class EmptyFont : GenericFont {
|
||||
|
||||
public override GenericFont Bold => this;
|
||||
public override GenericFont Italic => this;
|
||||
public override float LineHeight => 1;
|
||||
|
||||
protected override Vector2 MeasureChar(char c) {
|
||||
return Vector2.Zero;
|
||||
}
|
||||
|
||||
public override void DrawString(SpriteBatch batch, string text, Vector2 position, Color color, float rotation, Vector2 origin, Vector2 scale, SpriteEffects effects, float layerDepth) {
|
||||
}
|
||||
|
||||
public override void DrawString(SpriteBatch batch, StringBuilder text, Vector2 position, Color color, float rotation, Vector2 origin, Vector2 scale, SpriteEffects effects, float layerDepth) {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
13
README.md
13
README.md
|
@ -1,4 +1,4 @@
|
|||
<img src="Media/Logo.png" width="25%" >
|
||||
<img src="Media/Logo.png" width="25%" alt="The MLEM logo">
|
||||
|
||||
**MLEM Library for Extending MonoGame** is an addition to the game framework [MonoGame](https://www.monogame.net/) that provides extension methods, quality of life improvements and additional features like a ui system and easy input handling.
|
||||
|
||||
|
@ -20,16 +20,17 @@ If you created a game with the help of MLEM, you can get it added to this list b
|
|||
# Gallery
|
||||
Here are some images that show a couple of MLEM's features.
|
||||
|
||||
MLEM.Ui in action:
|
||||
<img src="Media/Ui.gif">
|
||||
The [MLEM.Ui](https://mlem.ellpeck.de/articles/ui) demo in action:
|
||||
|
||||
MLEM's text formatting system:
|
||||
<img src="Media/Formatting.png">
|
||||
<img src="Media/Ui.gif" alt="A gif showing various user interface elements from the MLEM.Ui demo">
|
||||
|
||||
MLEM's [text formatting system](https://mlem.ellpeck.de/articles/text_formatting), which is compatible with both MLEM.Ui and regular sprite batch rendering:
|
||||
|
||||
<img src="Media/Formatting.png" alt="An image showing text with various colors and other formatting">
|
||||
|
||||
# Friends of MLEM
|
||||
There are several other NuGet packages and tools that work well in combination with MonoGame and MLEM. Here are some of them:
|
||||
- [Contentless](https://github.com/Ellpeck/Contentless), a tool that removes the need to add assets to the MonoGame Content Pipeline manually
|
||||
- [GameBundle](https://github.com/Ellpeck/GameBundle), a tool that packages MonoGame and other .NET Core applications into several distributable formats
|
||||
- [ButlerDotNet](https://github.com/Ellpeck/ButlerDotNet), a tool that automatically downloads and invokes itch.io's butler
|
||||
- [MonoGame.Extended](https://github.com/craftworkgames/MonoGame.Extended), a package that also provides several additional features for MonoGame
|
||||
- [Coroutine](https://github.com/Ellpeck/Coroutine), a package that implements Unity-style coroutines for any project
|
Loading…
Reference in a new issue