Skip to content

Commit

Permalink
fixed fna compile errors
Browse files Browse the repository at this point in the history
  • Loading branch information
Ellpeck committed Nov 7, 2024
1 parent 5a10c8e commit e766516
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
3 changes: 2 additions & 1 deletion MLEM.Data/RuntimeTexturePacker.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
3 changes: 2 additions & 1 deletion Tests/TexturePackerTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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++) {
Expand Down

0 comments on commit e766516

Please sign in to comment.