1
0
Fork 0
mirror of https://github.com/Ellpeck/MLEM.git synced 2024-12-24 01:09:23 +01:00

set up a test project

This commit is contained in:
Ellpeck 2019-08-07 21:26:16 +02:00
parent 9f6143a68d
commit 38a9fbaac0
8 changed files with 53 additions and 10 deletions

View file

@ -17,7 +17,7 @@
<PackageReference Include="MonoGame.Extended" Version="3.6.0-beta0001">
<PrivateAssets>all</PrivateAssets>
</PackageReference>
<PackageReference Include="MonoGame.Framework.Portable" Version="3.7.0.1708">
<PackageReference Include="MonoGame.Framework.Portable" Version="3.6.0.1625">
<PrivateAssets>all</PrivateAssets>
</PackageReference>
</ItemGroup>

View file

@ -18,7 +18,7 @@
<PackageReference Include="Coroutine" Version="1.0.1"/>
<PackageReference Include="MonoGame.Extended" Version="3.6.0-beta0001"/>
<PackageReference Include="MonoGame.Extended.Input" Version="3.6.0-beta0001"/>
<PackageReference Include="MonoGame.Framework.Portable" Version="3.7.0.1708">
<PackageReference Include="MonoGame.Framework.Portable" Version="3.6.0.1625">
<PrivateAssets>all</PrivateAssets>
</PackageReference>
</ItemGroup>

View file

@ -6,6 +6,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MLEM.Extended", "MLEM.Exten
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MLEM.Startup", "MLEM.Startup\MLEM.Startup.csproj", "{997F4739-7BEC-4621-B9CA-68DEB2D74412}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Tests", "Tests\Tests.csproj", "{1BC4682B-AA14-4937-B5C7-707E20FE88FF}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@ -24,5 +26,9 @@ Global
{997F4739-7BEC-4621-B9CA-68DEB2D74412}.Debug|Any CPU.Build.0 = Debug|Any CPU
{997F4739-7BEC-4621-B9CA-68DEB2D74412}.Release|Any CPU.ActiveCfg = Release|Any CPU
{997F4739-7BEC-4621-B9CA-68DEB2D74412}.Release|Any CPU.Build.0 = Release|Any CPU
{1BC4682B-AA14-4937-B5C7-707E20FE88FF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{1BC4682B-AA14-4937-B5C7-707E20FE88FF}.Debug|Any CPU.Build.0 = Debug|Any CPU
{1BC4682B-AA14-4937-B5C7-707E20FE88FF}.Release|Any CPU.ActiveCfg = Release|Any CPU
{1BC4682B-AA14-4937-B5C7-707E20FE88FF}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
EndGlobal

View file

@ -14,7 +14,7 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="MonoGame.Framework.Portable" Version="3.7.0.1708">
<PackageReference Include="MonoGame.Framework.Portable" Version="3.6.0.1625">
<PrivateAssets>all</PrivateAssets>
</PackageReference>
</ItemGroup>

View file

@ -18,13 +18,12 @@ namespace MLEM.Misc {
var xDl = down && left ? connectsTo(-1, 1) ? 0 : 4 : left ? 1 : down ? 3 : 2;
var xDr = down && right ? connectsTo(1, 1) ? 0 : 4 : right ? 1 : down ? 3 : 2;
var (x, y) = pos;
var (sizeX, sizeY) = textureRegion.Size;
var (halfSizeX, halfSizeY) = new Point(sizeX / 2, sizeY / 2);
batch.Draw(texture, new Vector2(x, y), new Rectangle(textureRegion.X + 0 + xUl * sizeX, textureRegion.Y + 0, halfSizeX, halfSizeY), color, rotation, org, sc, SpriteEffects.None, layerDepth);
batch.Draw(texture, new Vector2(x + 0.5F * sizeX * sc.X, y), new Rectangle(textureRegion.X + halfSizeX + xUr * sizeX, textureRegion.Y + 0, halfSizeX, halfSizeY), color, rotation, org, sc, SpriteEffects.None, layerDepth);
batch.Draw(texture, new Vector2(x, y + 0.5F * sizeY * sc.Y), new Rectangle(textureRegion.X + xDl * sizeX, textureRegion.Y + halfSizeY, halfSizeX, halfSizeY), color, rotation, org, sc, SpriteEffects.None, layerDepth);
batch.Draw(texture, new Vector2(x + 0.5F * sizeX * sc.X, y + 0.5F * sizeY * sc.Y), new Rectangle(textureRegion.X + halfSizeX + xDr * sizeX, textureRegion.Y + halfSizeY, halfSizeX, halfSizeY), color, rotation, org, sc, SpriteEffects.None, layerDepth);
var size = textureRegion.Size;
var halfSize = new Point(size.X / 2, size.Y / 2);
batch.Draw(texture, new Vector2(pos.X, pos.Y), new Rectangle(textureRegion.X + 0 + xUl * size.X, textureRegion.Y + 0, halfSize.X, halfSize.Y), color, rotation, org, sc, SpriteEffects.None, layerDepth);
batch.Draw(texture, new Vector2(pos.X + 0.5F * size.X * sc.X, pos.Y), new Rectangle(textureRegion.X + halfSize.X + xUr * size.X, textureRegion.Y + 0, halfSize.X, halfSize.Y), color, rotation, org, sc, SpriteEffects.None, layerDepth);
batch.Draw(texture, new Vector2(pos.X, pos.Y + 0.5F * size.Y * sc.Y), new Rectangle(textureRegion.X + xDl * size.X, textureRegion.Y + halfSize.Y, halfSize.X, halfSize.Y), color, rotation, org, sc, SpriteEffects.None, layerDepth);
batch.Draw(texture, new Vector2(pos.X + 0.5F * size.X * sc.X, pos.Y + 0.5F * size.Y * sc.Y), new Rectangle(textureRegion.X + halfSize.X + xDr * size.X, textureRegion.Y + halfSize.Y, halfSize.X, halfSize.Y), color, rotation, org, sc, SpriteEffects.None, layerDepth);
}
public delegate bool ConnectsTo(int xOff, int yOff);

8
Tests/GameImpl.cs Normal file
View file

@ -0,0 +1,8 @@
using MLEM.Startup;
namespace Tests {
public class GameImpl : MlemGame {
}
}

12
Tests/Program.cs Normal file
View file

@ -0,0 +1,12 @@
using System;
namespace Tests {
public static class Program {
public static void Main() {
using (var game = new GameImpl())
game.Run();
}
}
}

18
Tests/Tests.csproj Normal file
View file

@ -0,0 +1,18 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp2.0</TargetFramework>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\MLEM.Extended\MLEM.Extended.csproj" />
<ProjectReference Include="..\MLEM.Startup\MLEM.Startup.csproj" />
<ProjectReference Include="..\MLEM\MLEM.csproj" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="MonoGame.Framework.DesktopGL.Core" Version="3.7.0.7" />
</ItemGroup>
</Project>