1
0
Fork 0
mirror of https://github.com/Ellpeck/MLEM.git synced 2024-11-27 15:08:33 +01:00

Compare commits

..

No commits in common. "b935bd0a6115854ae888eb8892636d136b3b2667" and "e191d4919b9d7566e035b65c4c8a2a38f7776812" have entirely different histories.

11 changed files with 19 additions and 37 deletions

View file

@ -34,7 +34,6 @@ 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
@ -46,10 +45,6 @@ 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

View file

@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk"> <Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup> <PropertyGroup>
<TargetFramework>net8.0</TargetFramework> <TargetFramework>netstandard2.0</TargetFramework>
<RootNamespace>Demos</RootNamespace> <RootNamespace>Demos</RootNamespace>
<DefineConstants>$(DefineConstants);FNA</DefineConstants> <DefineConstants>$(DefineConstants);FNA</DefineConstants>
<IsPackable>false</IsPackable> <IsPackable>false</IsPackable>

View file

@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk"> <Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup> <PropertyGroup>
<TargetFramework>net8.0</TargetFramework> <TargetFramework>netstandard2.0</TargetFramework>
<IsPackable>false</IsPackable> <IsPackable>false</IsPackable>
</PropertyGroup> </PropertyGroup>

View file

@ -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, rotation, Vector2.Zero, scale, layerDepth); this.Font.DrawText(batch, character, position, color, scale, rotation, Vector2.Zero, layerDepth);
} }
} }

View file

@ -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.3.3"> <PackageReference Include="FontStashSharp.MonoGame" Version="1.2.8">
<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">

View file

@ -96,11 +96,6 @@ 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;
@ -158,14 +153,6 @@ 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) {
@ -176,12 +163,6 @@ 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);
} }

View file

@ -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.3.3" /> <PackageReference Include="FontStashSharp.MonoGame" Version="1.2.8" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" /> <PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
</ItemGroup> </ItemGroup>

View file

@ -21,9 +21,12 @@
<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">
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.8.0" /> <PrivateAssets>all</PrivateAssets>
<PackageReference Include="NUnit" Version="3.14.0" /> <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</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>

View file

@ -20,9 +20,12 @@
<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">
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.8.0" /> <PrivateAssets>all</PrivateAssets>
<PackageReference Include="NUnit" Version="3.14.0" /> <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</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

@ -1 +1 @@
Subproject commit 354e2161b759fa052b25e94209d6ea463aaf098f Subproject commit d0a0892f17dd8bebd36319294509cdca8ae8c810

@ -1 +1 @@
Subproject commit 2d40e9f0f681595dbd4341a3e5a64ed6e31f9556 Subproject commit c50bf544bcfb217b518727a0a38eb71fc5725092