mirror of
https://github.com/Ellpeck/MLEM.git
synced 2024-11-22 12:58:33 +01:00
Merge remote-tracking branch 'origin/main'
This commit is contained in:
commit
7e345e7437
12 changed files with 42 additions and 23 deletions
|
@ -34,6 +34,7 @@ Fixes
|
||||||
Additions
|
Additions
|
||||||
- Added UiControls.NavType, which stores the most recently used type of ui navigation
|
- Added UiControls.NavType, which stores the most recently used type of ui navigation
|
||||||
- Added SetWidthBasedOnAspect and SetHeightBasedOnAspect to images
|
- Added SetWidthBasedOnAspect and SetHeightBasedOnAspect to images
|
||||||
|
- Added the ability to set a custom SamplerState for images
|
||||||
|
|
||||||
Improvements
|
Improvements
|
||||||
- Allow scrolling panels to contain other scrolling panels
|
- Allow scrolling panels to contain other scrolling panels
|
||||||
|
@ -45,6 +46,10 @@ Fixes
|
||||||
- Fixed panels updating their relevant children too much when the scroll bar is hidden
|
- Fixed panels updating their relevant children too much when the scroll bar is hidden
|
||||||
- Fixed a stack overflow exception when a panel's scroll bar auto-hiding causes elements to gain height
|
- Fixed a stack overflow exception when a panel's scroll bar auto-hiding causes elements to gain height
|
||||||
|
|
||||||
|
### MLEM.Extended
|
||||||
|
Improvements
|
||||||
|
- Updated to FontStashSharp 1.3.0's API
|
||||||
|
|
||||||
### MLEM.Data
|
### MLEM.Data
|
||||||
Fixes
|
Fixes
|
||||||
- Fixed various exception types not being wrapped by ContentLoadExceptions when loading raw or JSON content
|
- Fixed various exception types not being wrapped by ContentLoadExceptions when loading raw or JSON content
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
<Project Sdk="Microsoft.NET.Sdk">
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TargetFramework>netstandard2.0</TargetFramework>
|
<TargetFramework>net8.0</TargetFramework>
|
||||||
<RootNamespace>Demos</RootNamespace>
|
<RootNamespace>Demos</RootNamespace>
|
||||||
<DefineConstants>$(DefineConstants);FNA</DefineConstants>
|
<DefineConstants>$(DefineConstants);FNA</DefineConstants>
|
||||||
<IsPackable>false</IsPackable>
|
<IsPackable>false</IsPackable>
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
<Project Sdk="Microsoft.NET.Sdk">
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TargetFramework>netstandard2.0</TargetFramework>
|
<TargetFramework>net8.0</TargetFramework>
|
||||||
<IsPackable>false</IsPackable>
|
<IsPackable>false</IsPackable>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
|
|
|
@ -38,7 +38,7 @@ namespace MLEM.Extended.Font {
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
protected override void DrawCharacter(SpriteBatch batch, int codePoint, string character, Vector2 position, Color color, float rotation, Vector2 scale, SpriteEffects effects, float layerDepth) {
|
protected override void DrawCharacter(SpriteBatch batch, int codePoint, string character, Vector2 position, Color color, float rotation, Vector2 scale, SpriteEffects effects, float layerDepth) {
|
||||||
this.Font.DrawText(batch, character, position, color, scale, rotation, Vector2.Zero, layerDepth);
|
this.Font.DrawText(batch, character, position, color, rotation, Vector2.Zero, scale, layerDepth);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,7 +27,7 @@
|
||||||
<PackageReference Include="MonoGame.Extended.Tiled" Version="3.8.0">
|
<PackageReference Include="MonoGame.Extended.Tiled" Version="3.8.0">
|
||||||
<PrivateAssets>all</PrivateAssets>
|
<PrivateAssets>all</PrivateAssets>
|
||||||
</PackageReference>
|
</PackageReference>
|
||||||
<PackageReference Include="FontStashSharp.MonoGame" Version="1.2.8">
|
<PackageReference Include="FontStashSharp.MonoGame" Version="1.3.3">
|
||||||
<PrivateAssets>all</PrivateAssets>
|
<PrivateAssets>all</PrivateAssets>
|
||||||
</PackageReference>
|
</PackageReference>
|
||||||
<PackageReference Include="MonoGame.Framework.DesktopGL" Version="3.8.0.1641">
|
<PackageReference Include="MonoGame.Framework.DesktopGL" Version="3.8.0.1641">
|
||||||
|
|
|
@ -1236,12 +1236,13 @@ namespace MLEM.Ui.Elements {
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public override string ToString() {
|
public override string ToString() {
|
||||||
var ret = this.GetType().ToString();
|
var ret = this.GetType().Name;
|
||||||
// elements will contain their path up to the root (Paragraph@Panel@...@RootName)
|
// elements will contain their path up to the root and their index in each parent
|
||||||
|
// eg Paragraph 2 @ Panel 3 @ ... @ Group RootName
|
||||||
if (this.Parent != null) {
|
if (this.Parent != null) {
|
||||||
ret += $"@{this.Parent}";
|
ret += $" {this.Parent.Children.IndexOf(this)} @ {this.Parent}";
|
||||||
} else if (this.Root?.Element == this) {
|
} else if (this.Root?.Element == this) {
|
||||||
ret += $"@{this.Root.Name}";
|
ret += $" {this.Root.Name}";
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
|
@ -96,6 +96,11 @@ namespace MLEM.Ui.Elements {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// The sampler state that this image's <see cref="Texture"/> should be drawn with.
|
||||||
|
/// If this is <see langword="null"/>, the current <see cref="SpriteBatchContext"/>'s <see cref="SpriteBatchContext.SamplerState"/> will be used, which will likely be the same as <see cref="UiSystem.SpriteBatchContext"/>.
|
||||||
|
/// </summary>
|
||||||
|
public SamplerState SamplerState;
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public override bool IsHidden => base.IsHidden || this.Texture == null;
|
public override bool IsHidden => base.IsHidden || this.Texture == null;
|
||||||
|
@ -153,6 +158,14 @@ namespace MLEM.Ui.Elements {
|
||||||
public override void Draw(GameTime time, SpriteBatch batch, float alpha, SpriteBatchContext context) {
|
public override void Draw(GameTime time, SpriteBatch batch, float alpha, SpriteBatchContext context) {
|
||||||
if (this.Texture == null)
|
if (this.Texture == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
if (this.SamplerState != null) {
|
||||||
|
batch.End();
|
||||||
|
var localContext = context;
|
||||||
|
localContext.SamplerState = this.SamplerState;
|
||||||
|
batch.Begin(localContext);
|
||||||
|
}
|
||||||
|
|
||||||
var center = new Vector2(this.Texture.Width / 2F, this.Texture.Height / 2F);
|
var center = new Vector2(this.Texture.Width / 2F, this.Texture.Height / 2F);
|
||||||
var color = this.Color.OrDefault(Microsoft.Xna.Framework.Color.White) * alpha;
|
var color = this.Color.OrDefault(Microsoft.Xna.Framework.Color.White) * alpha;
|
||||||
if (this.MaintainImageAspect) {
|
if (this.MaintainImageAspect) {
|
||||||
|
@ -163,6 +176,12 @@ namespace MLEM.Ui.Elements {
|
||||||
var scale = new Vector2(1F / this.Texture.Width, 1F / this.Texture.Height) * this.DisplayArea.Size;
|
var scale = new Vector2(1F / this.Texture.Width, 1F / this.Texture.Height) * this.DisplayArea.Size;
|
||||||
batch.Draw(this.Texture, this.DisplayArea.Location + center * scale, color, this.ImageRotation, center, scale * this.ImageScale, this.ImageEffects, 0);
|
batch.Draw(this.Texture, this.DisplayArea.Location + center * scale, color, this.ImageRotation, center, scale * this.ImageScale, this.ImageEffects, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (this.SamplerState != null) {
|
||||||
|
batch.End();
|
||||||
|
batch.Begin(context);
|
||||||
|
}
|
||||||
|
|
||||||
base.Draw(time, batch, alpha, context);
|
base.Draw(time, batch, alpha, context);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -19,7 +19,7 @@
|
||||||
<PackageReference Include="MonoGame.Extended.Content.Pipeline" Version="3.8.0" />
|
<PackageReference Include="MonoGame.Extended.Content.Pipeline" Version="3.8.0" />
|
||||||
<PackageReference Include="MonoGame.Extended.Tiled" Version="3.8.0" />
|
<PackageReference Include="MonoGame.Extended.Tiled" Version="3.8.0" />
|
||||||
<PackageReference Include="MonoGame.Framework.DesktopGL" Version="3.8.1.303" />
|
<PackageReference Include="MonoGame.Framework.DesktopGL" Version="3.8.1.303" />
|
||||||
<PackageReference Include="FontStashSharp.MonoGame" Version="1.2.8" />
|
<PackageReference Include="FontStashSharp.MonoGame" Version="1.3.3" />
|
||||||
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
|
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
|
|
|
@ -21,12 +21,9 @@
|
||||||
<ProjectReference Include="..\ThirdParty\FNA\FNA.Core.csproj" />
|
<ProjectReference Include="..\ThirdParty\FNA\FNA.Core.csproj" />
|
||||||
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
|
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
|
||||||
|
|
||||||
<PackageReference Include="coverlet.collector" Version="6.0.0">
|
<PackageReference Include="coverlet.collector" Version="6.0.0" />
|
||||||
<PrivateAssets>all</PrivateAssets>
|
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.8.0" />
|
||||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
<PackageReference Include="NUnit" Version="3.14.0" />
|
||||||
</PackageReference>
|
|
||||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.7.2" />
|
|
||||||
<PackageReference Include="NUnit" Version="3.13.3" />
|
|
||||||
<PackageReference Include="NUnit3TestAdapter" Version="4.5.0" />
|
<PackageReference Include="NUnit3TestAdapter" Version="4.5.0" />
|
||||||
<PackageReference Include="NunitXml.TestLogger" Version="3.1.15" />
|
<PackageReference Include="NunitXml.TestLogger" Version="3.1.15" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
|
@ -20,12 +20,9 @@
|
||||||
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
|
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
|
||||||
<PackageReference Include="MonoGame.Extended" Version="3.8.0" />
|
<PackageReference Include="MonoGame.Extended" Version="3.8.0" />
|
||||||
|
|
||||||
<PackageReference Include="coverlet.collector" Version="6.0.0">
|
<PackageReference Include="coverlet.collector" Version="6.0.0" />
|
||||||
<PrivateAssets>all</PrivateAssets>
|
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.8.0" />
|
||||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
<PackageReference Include="NUnit" Version="3.14.0" />
|
||||||
</PackageReference>
|
|
||||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.7.2" />
|
|
||||||
<PackageReference Include="NUnit" Version="3.13.3" />
|
|
||||||
<PackageReference Include="NUnit3TestAdapter" Version="4.5.0" />
|
<PackageReference Include="NUnit3TestAdapter" Version="4.5.0" />
|
||||||
<PackageReference Include="NunitXml.TestLogger" Version="3.1.15" />
|
<PackageReference Include="NunitXml.TestLogger" Version="3.1.15" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
2
ThirdParty/FNA
vendored
2
ThirdParty/FNA
vendored
|
@ -1 +1 @@
|
||||||
Subproject commit d0a0892f17dd8bebd36319294509cdca8ae8c810
|
Subproject commit 354e2161b759fa052b25e94209d6ea463aaf098f
|
2
ThirdParty/FontStashSharp
vendored
2
ThirdParty/FontStashSharp
vendored
|
@ -1 +1 @@
|
||||||
Subproject commit c50bf544bcfb217b518727a0a38eb71fc5725092
|
Subproject commit 2d40e9f0f681595dbd4341a3e5a64ed6e31f9556
|
Loading…
Reference in a new issue