remove monogame dependency

drone
thatcosmonaut 2019-10-31 15:57:04 -07:00
parent 12ecafa9a5
commit d27b5c55d3
6 changed files with 22 additions and 13 deletions

10
Structs/MathHelper.cs Normal file
View File

@ -0,0 +1,10 @@
namespace MoonTools.Core.Structs
{
public static class MathHelper
{
public static double ToRadians(double angle)
{
return (System.Math.PI / 180) * angle;
}
}
}

View File

@ -1,5 +1,5 @@
using System; using System;
using Microsoft.Xna.Framework; using System.Numerics;
namespace MoonTools.Core.Structs namespace MoonTools.Core.Structs
{ {

View File

@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk"> <Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup> <PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework> <TargetFramework>netstandard2.1</TargetFramework>
<RootNamespace>MoonTools.Core.Structs</RootNamespace> <RootNamespace>MoonTools.Core.Structs</RootNamespace>
<PackageId>MoonTools.Core.Structs</PackageId> <PackageId>MoonTools.Core.Structs</PackageId>
<Version>1.1.0</Version> <Version>1.1.0</Version>
@ -14,7 +14,4 @@
<PackageProjectUrl>https://github.com/MoonsideGames/MoonTools.Core.Structs</PackageProjectUrl> <PackageProjectUrl>https://github.com/MoonsideGames/MoonTools.Core.Structs</PackageProjectUrl>
<PackageLicenseExpression>LGPL-3.0-only</PackageLicenseExpression> <PackageLicenseExpression>LGPL-3.0-only</PackageLicenseExpression>
</PropertyGroup> </PropertyGroup>
<ItemGroup>
<PackageReference Include="MonoGame.Framework.DesktopGL.Core" Version="3.7.0.7" />
</ItemGroup>
</Project> </Project>

View File

@ -1,5 +1,5 @@
using System; using System;
using Microsoft.Xna.Framework; using System.Numerics;
namespace MoonTools.Core.Structs namespace MoonTools.Core.Structs
{ {
@ -16,7 +16,7 @@ namespace MoonTools.Core.Structs
private float _rotation; private float _rotation;
private Vector2 _scale; private Vector2 _scale;
public Matrix TransformMatrix { get; private set; } public Matrix4x4 TransformMatrix { get; private set; }
public Position2D Position public Position2D Position
{ {
@ -119,11 +119,11 @@ namespace MoonTools.Core.Structs
return new Transform2D(Position + other.Position, Rotation + other.Rotation, Scale * other.Scale); return new Transform2D(Position + other.Position, Rotation + other.Rotation, Scale * other.Scale);
} }
private static Matrix CreateTransformMatrix(Position2D translation, float rotationDegrees, Vector2 scale) private static Matrix4x4 CreateTransformMatrix(Position2D translation, float rotation, Vector2 scale)
{ {
return Matrix.CreateScale(scale.X, scale.Y, 1) * return Matrix4x4.CreateScale(scale.X, scale.Y, 1) *
Matrix.CreateRotationZ(Microsoft.Xna.Framework.MathHelper.ToRadians(rotationDegrees)) * Matrix4x4.CreateRotationZ(rotation) *
Matrix.CreateTranslation(translation.X, translation.Y, 0); Matrix4x4.CreateTranslation(translation.X, translation.Y, 0);
} }
public override bool Equals(Object other) public override bool Equals(Object other)

View File

@ -1,7 +1,8 @@
using FluentAssertions; using FluentAssertions;
using Microsoft.Xna.Framework;
using NUnit.Framework; using NUnit.Framework;
using MoonTools.Core.Structs; using MoonTools.Core.Structs;
using System.Numerics;
namespace Tests namespace Tests
{ {

View File

@ -1,7 +1,8 @@
using FluentAssertions; using FluentAssertions;
using Microsoft.Xna.Framework;
using NUnit.Framework; using NUnit.Framework;
using MoonTools.Core.Structs; using MoonTools.Core.Structs;
using System.Numerics;
namespace Tests namespace Tests
{ {