30.09.2020

+ Mouse support
+ Started to add summaries to SM.Base
This commit is contained in:
Michel Fedde 2020-09-30 21:26:42 +02:00
parent 16366fa015
commit 7acdba92f8
21 changed files with 325 additions and 58 deletions

View file

@ -1,4 +1,5 @@
using System;
using System.Configuration.Assemblies;
using OpenTK;
namespace SM.Base.Types
@ -41,7 +42,64 @@ namespace SM.Base.Types
_z = z;
_w = w;
}
#region Set
protected void Set(float x, float y)
{
_X = x;
_Y = y;
}
protected void Set(OpenTK.Vector2 vector)
{
Set(vector.X, vector.Y);
}
protected void Set(float x, float y, float z)
{
Set(x,y);
_Z = z;
}
protected void Set(OpenTK.Vector3 vector)
{
Set(vector.X, vector.Y, vector.Z);
}
protected void Set(float x, float y, float z, float w)
{
Set(x,y,z);
_W = w;
}
protected void Set(OpenTK.Vector4 vector)
{
Set(vector.X, vector.Y, vector.Z, vector.W);
}
#endregion
#region Add
protected void Add(OpenTK.Vector2 vector)
{
_X += vector.X;
_Y += vector.Y;
}
protected void Add(OpenTK.Vector3 vector)
{
_X += vector.X;
_Y += vector.Y;
_Z += vector.Z;
}
protected void Add(OpenTK.Vector4 vector)
{
_X += vector.X;
_Y += vector.Y;
_Z += vector.Z;
_W += vector.W;
}
#endregion
public static implicit operator OpenTK.Vector2(Vector v) => new OpenTK.Vector2(v._x, v._y);
public static implicit operator OpenTK.Vector3(Vector v) => new OpenTK.Vector3(v._x, v._y, v._z);
public static implicit operator OpenTK.Vector4(Vector v) => new OpenTK.Vector4(v._x, v._y, v._z, v._w);

View file

@ -23,6 +23,10 @@
public Vector2(float x, float y) : base(x,y, default, default) {}
protected Vector2(float x, float y, float z, float w) : base(x, y, z, w) {}
public new void Set(float x, float y) => base.Set(x, y);
public new void Set(OpenTK.Vector2 vector) => base.Set(vector);
public new void Add(OpenTK.Vector2 vector) => base.Add(vector);
public static implicit operator Vector2(OpenTK.Vector2 v) => new Vector2(v.X, v.Y);
}