From e76651699a7fdf701569c0b199570fbdc020b852 Mon Sep 17 00:00:00 2001 From: Ellpeck Date: Thu, 7 Nov 2024 16:10:55 +0100 Subject: [PATCH] fixed fna compile errors --- MLEM.Data/RuntimeTexturePacker.cs | 3 ++- Tests/TexturePackerTests.cs | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/MLEM.Data/RuntimeTexturePacker.cs b/MLEM.Data/RuntimeTexturePacker.cs index 11a6d344..0b147e9e 100644 --- a/MLEM.Data/RuntimeTexturePacker.cs +++ b/MLEM.Data/RuntimeTexturePacker.cs @@ -197,7 +197,8 @@ public void Pack(GraphicsDevice device) { // invoke callbacks for textures we copied foreach (var request in this.requests) { - var packedArea = new Rectangle(request.Node.Area.Location + new Point(request.Padding), request.Texture.Size); + var packedLoc = request.Node.Area.Location + new Point(request.Padding, request.Padding); + var packedArea = new Rectangle(packedLoc.X, packedLoc.Y, request.Texture.Width, request.Texture.Height); request.Result.Invoke(new TextureRegion(this.PackedTexture, packedArea) { Pivot = request.Texture.Pivot, Name = request.Texture.Name, diff --git a/Tests/TexturePackerTests.cs b/Tests/TexturePackerTests.cs index 4f021356..de5c6844 100644 --- a/Tests/TexturePackerTests.cs +++ b/Tests/TexturePackerTests.cs @@ -3,6 +3,7 @@ using System.IO; using Microsoft.Xna.Framework.Graphics; using MLEM.Data; +using MLEM.Graphics; using MLEM.Maths; using MLEM.Textures; using NUnit.Framework; @@ -133,7 +134,7 @@ public void TestPackTimes([Values(1, 100, 1000, 5000, 10000)] int total) { } private TextureRegion MakeTextureRegion(int width, int height) { - var color = new Color((uint) SingleRandom.Int(this.generatedTextures.Count)) {A = 255}; + var color = ColorHelper.FromHexRgb(SingleRandom.Int(this.generatedTextures.Count)); var texture = new Texture2D(this.Game.GraphicsDevice, Math.Max(width, 1), Math.Max(height, 1)); using (var data = texture.GetTextureData()) { for (var x = 0; x < texture.Width; x++) {