Files
Christopher Whitley 3a5269cfea Reorganization (#909)
* Removed MonoGame.Extended.Animations
This project was just a shell that referenced MonoGame.Extended.csproj. It added no additional functionality.

* Rework BitmapFonts for new project organization.

* Cleanup namespaces

* Cleanup namespaces

* Move MonoGame.Extended.Collision into base project

* Moved MonoGame.Extended.Entities into base project

* Moved MonoGame.Extended.Graphics into base project

* Moved MonoGame.Extended.Graphics into base project

* Moved MonoGame.Extended.Input into base project

* Moved MonoGame.Extended.Particles into base project

* Moved MonoGame.Extended.Tiled into base project

* Moved MonoGame.Extended.Tiled into base project

* Moved MonoGame.Extended.Tweening into base project

* Removing SpriteFactory support
This will be added back in at a later date once the SpriteFactory application has been updated

* Update TexturePacker content import support

* Only needs to reference base project now

* Moved to Serialization namespace

* Moved  Json serialization to Serialization.Json namespace

* Moved TexturePacker content DTOs to the Content namespace

* Renamed to Texture2DRegion.Extensions.cs

* Cleaned up namespace

* Moved ReadTiledMapProperties into the ContentReaderExtensions

* Created an Extended content manager

* Moved Tweening tests to base test project

* Moved Tiled test to base test project

* Moved Entities Tests to base test project

* Moved Entities tests to base test project

* Moved Collisions tests to base test project

* Moved Pipeline Tiled test to Pipeline tests project

* Use `var` instead of full type name

* Add Tiled namespace

* Correct `Metadata` property name to new `Meta` property name

* Cleanup namespace

* Add effects namespace

* Add Content namespace

* Update using statements to new namespaces

* Move Pipeline Tiled tests to Pipeline test project

* Use correct namespace

* Use `var` instead of typing out nested types

* Remove unused namespaces

* Update to new namespaces

* Remove unused namespaces

* Update to new namespaces

* Remove dependency on Particles csproj

* Update included content on build

* Add embedded resources

* Merge multi csproj structure into single csproj structure

* TexturePackerPoint properties should be `double` not `int`

* Update csproj

* Use dotnet tool to rebuild effects

* Move effect compilation to targets file
This will ensure the effects are always built

* Fix workflow to build effects on linux

* Set wine path

* Export instead of using actions env section

* Revert back to manual effect compile until automation can be solved on GitHub Ubuntu runner
2024-07-06 23:46:20 -04:00

292 lines
9.7 KiB
C#

//using Microsoft.Xna.Framework;
//using Microsoft.Xna.Framework.Graphics;
//using MonoGame.Extended.Shapes;
//using MonoGame.Extended.TextureAtlases;
//using MonoGame.Extended.Tiled;
//using MonoGame.Extended.Tiled.Graphics;
//using NSubstitute;
//using Xunit;
//namespace MonoGame.Extended.Tests.Tiled.Renderers
//{
//
// public class FullMapRendererTest
// {
// [Fact]
// public void Draw_MapObjectLayer_MissingGID_NoGroups()
// {
// var gd = TestHelper.CreateGraphicsDevice();
// var r = new MockRenderer(gd);
// var texture = Substitute.For<Texture2D>(gd, 64, 64);
// var m = new TiledMap("test", 2, 2, 32, 32);
// m.CreateTileset(texture, 0, 32, 32, 4);
// IShapeF shape = new RectangleF(1, 1, 1, 1);
// TiledObject[] objs =
// {
// new TiledObject(TiledObjectType.Tile, 1, null, shape, 1, 1) { IsVisible = true },
// };
// var layer = new TiledObjectLayer("object", objs);
// m.AddLayer(layer);
// r.Map = m;
// r.Draw(new Matrix());
// Assert.IsNull(gd.Indices);
// }
// [Fact]
// public void Draw_MapObjectLayer_ShapeObject_NoGroups()
// {
// var gd = TestHelper.CreateGraphicsDevice();
// var r = new MockRenderer(gd);
// var texture = Substitute.For<Texture2D>(gd, 64, 64);
// var m = new TiledMap("test", 2, 2, 32, 32);
// m.CreateTileset(texture, 0, 32, 32, 4);
// IShapeF shape = new RectangleF(1, 1, 1, 1);
// TiledObject[] objs =
// {
// new TiledObject(TiledObjectType.Rectangle, 1, 1, shape, 1, 1) { IsVisible = true },
// };
// var layer = new TiledObjectLayer("object", objs);
// m.AddLayer(layer);
// r.Map = m;
// r.Draw(new Matrix());
// Assert.IsNull(gd.Indices);
// }
// [Fact]
// public void Draw_MapObjectLayer_TileObject_OneGroup()
// {
// var gd = TestHelper.CreateGraphicsDevice();
// var r = new MockRenderer(gd);
// var texture = Substitute.For<Texture2D>(gd, 64, 64);
// var m = new TiledMap("test", 2, 2, 32, 32);
// m.CreateTileset(texture, 0, 32, 32, 4);
// IShapeF shape = new RectangleF(1, 1, 1, 1);
// TiledObject[] objs =
// {
// new TiledObject(TiledObjectType.Tile, 1, 1, shape, 1, 1) { IsVisible = true },
// };
// var layer = new TiledObjectLayer("object", objs);
// m.AddLayer(layer);
// r.Map = m;
// r.Draw(new Matrix());
// Assert.NotNull(gd.Indices);
// Assert.Equal(6, gd.Indices.IndexCount);
// }
// [Fact]
// public void Draw_MapObjectLayer_NotVisible_NoGroups()
// {
// var gd = TestHelper.CreateGraphicsDevice();
// var r = new MockRenderer(gd);
// var texture = Substitute.For<Texture2D>(gd, 64, 64);
// var m = new TiledMap("test", 2, 2, 32, 32);
// m.CreateTileset(texture, 0, 32, 32, 4);
// IShapeF shape = new RectangleF(1, 1, 1, 1);
// TiledObject[] objs =
// {
// new TiledObject(TiledObjectType.Tile, 1, 1, shape, 1, 1) { IsVisible = false },
// };
// var layer = new TiledObjectLayer("object", objs);
// m.AddLayer(layer);
// r.Map = m;
// r.Draw(new Matrix());
// Assert.IsNull(gd.Indices);
// }
// [Fact]
// public void Draw_MapObjectLayer_NoObjects_NoGroups()
// {
// var gd = TestHelper.CreateGraphicsDevice();
// var r = new MockRenderer(gd);
// var texture = Substitute.For<Texture2D>(gd, 64, 64);
// var m = new TiledMap("test", 2, 2, 32, 32);
// m.CreateTileset(texture, 0, 32, 32, 4);
// TiledObject[] objs = {};
// var layer = new TiledObjectLayer("object", objs);
// m.AddLayer(layer);
// r.Map = m;
// r.Draw(new Matrix());
// Assert.IsNull(gd.Indices);
// }
// [Fact]
// public void Draw_MapTileLayer_TwoVisible_OneGroup()
// {
// var gd = TestHelper.CreateGraphicsDevice();
// var r = new MockRenderer(gd);
// var texture = Substitute.For<Texture2D>(gd, 64, 64);
// var m = new TiledMap("test", 2, 2, 32, 32);
// m.CreateTileset(texture, 0, 32, 32, 4);
// m.CreateTileLayer("tile", 2, 2, new int[] { 1, 0, 1, 0 });
// r.Map = m;
// r.Draw(new Matrix());
// Assert.NotNull(gd.Indices);
// Assert.Equal(12, gd.Indices.IndexCount);
// }
// [Fact]
// public void Draw_MapTileLayer_AllBlank_NoGroups()
// {
// var gd = TestHelper.CreateGraphicsDevice();
// var r = new MockRenderer(gd);
// var texture = Substitute.For<Texture2D>(gd, 64, 64);
// var m = new TiledMap("test", 2, 2, 32, 32);
// m.CreateTileset(texture, 0, 32, 32, 4);
// m.CreateTileLayer("tile", 2, 2, new int[] { 0, 0, 0, 0 });
// r.Map = m;
// r.Draw(new Matrix());
// Assert.IsNull(gd.Indices);
// }
// [Fact]
// public void Draw_MapImageLayer_OneGroup()
// {
// var gd = TestHelper.CreateGraphicsDevice();
// var r = new MockRenderer(gd);
// var texture = Substitute.For<Texture2D>(gd, 64, 64);
// var m = new TiledMap("test", 10, 10, 32, 32);
// m.CreateImageLayer("img", texture, new Vector2(100, 100));
// r.Map = m;
// r.Draw(new Matrix());
// Assert.NotNull(gd.Indices);
// Assert.Equal(6, gd.Indices.IndexCount);
// }
// [Fact]
// public void Draw_MapNoGroups()
// {
// var gd = TestHelper.CreateGraphicsDevice();
// var r = new MockRenderer(gd);
// r.Map = new TiledMap("test", 10, 10, 32, 32);
// r.Draw(new Matrix());
// Assert.IsNull(gd.Indices);
// }
// [Fact]
// public void Draw_NoMap()
// {
// var gd = TestHelper.CreateGraphicsDevice();
// var r = new MockRenderer(gd);
// r.Draw(new Matrix());
// Assert.IsNull(gd.Indices);
// }
// [Fact]
// public void CreatePrimatives()
// {
// var gd = TestHelper.CreateGraphicsDevice();
// var texture = Substitute.For<Texture2D>(gd, 64, 64);
// var region = Substitute.For<TextureRegion2D>(texture, 1, 1, 32, 32);
// VertexPositionTexture[] vertices;
// ushort[] indexes;
// var r = new MockRenderer(gd);
// r.CreatePrimitives(new Point(0, 0), region, 0, 0.5f, out vertices, out indexes);
// Assert.Equal(4, vertices.Length);
// Assert.Equal(new Vector3(0, 0, .5f), vertices[0].Position);
// Assert.Equal(new Vector2(0.0234375f, 0.0234375f), vertices[0].TextureCoordinate);
// Assert.Equal(new Vector3(32, 0, .5f), vertices[1].Position);
// Assert.Equal(new Vector2(0.515625f, 0.0234375f), vertices[1].TextureCoordinate);
// Assert.Equal(new Vector3(0, 32, .5f), vertices[2].Position);
// Assert.Equal(new Vector2(0.0234375f, 0.515625f), vertices[2].TextureCoordinate);
// Assert.Equal(new Vector3(32, 32, .5f), vertices[3].Position);
// Assert.Equal(new Vector2(0.515625f, 0.515625f), vertices[3].TextureCoordinate);
// CollectionAssert.Equal(new[] { 0, 1, 2, 1, 3, 2 }, indexes);
// }
// [Fact]
// public void CreatePrimatives_Offset10()
// {
// var gd = TestHelper.CreateGraphicsDevice();
// var texture = Substitute.For<Texture2D>(gd, 64, 64);
// var region = Substitute.For<TextureRegion2D>(texture, 1, 1, 32, 32);
// VertexPositionTexture[] vertices;
// ushort[] indexes;
// var r = new MockRenderer(gd);
// r.CreatePrimitives(new Point(0, 0), region, 10, 0.5f, out vertices, out indexes);
// Assert.Equal(4, vertices.Length);
// Assert.Equal(new Vector3(0, 0, .5f), vertices[0].Position);
// Assert.Equal(new Vector2(0.0234375f, 0.0234375f), vertices[0].TextureCoordinate);
// Assert.Equal(new Vector3(32, 0, .5f), vertices[1].Position);
// Assert.Equal(new Vector2(0.515625f, 0.0234375f), vertices[1].TextureCoordinate);
// Assert.Equal(new Vector3(0, 32, .5f), vertices[2].Position);
// Assert.Equal(new Vector2(0.0234375f, 0.515625f), vertices[2].TextureCoordinate);
// Assert.Equal(new Vector3(32, 32, .5f), vertices[3].Position);
// Assert.Equal(new Vector2(0.515625f, 0.515625f), vertices[3].TextureCoordinate);
// CollectionAssert.Equal(new[] { 40, 41, 42, 41, 43, 42 }, indexes);
// }
// }
// internal class MockRenderer : TiledMapRenderer
// {
// public MockRenderer(GraphicsDevice graphicsDevice)
// : base(graphicsDevice)
// {
// }
// public void CreatePrimitives(Point point, TextureRegion2D region, int offset, float depth,
// out VertexPositionTexture[] vertices, out ushort[] indexes)
// {
// base.CreatePrimitives(point, region, offset, depth, out vertices, out indexes);
// }
// public new void Draw(Matrix viewMatrix)
// {
// base.Draw(viewMatrix);
// }
// }
//}