19.09.2020
+ Vector-classes + Added Background ~ Changed OpenTK.Vector2 to SM.Base.Types.Vector2
This commit is contained in:
parent
a603ecc417
commit
acccf5f0e7
22 changed files with 295 additions and 27 deletions
|
|
@ -1,5 +1,6 @@
|
|||
using OpenTK;
|
||||
using SM.Base.Scene;
|
||||
using Vector2 = SM.Base.Types.Vector2;
|
||||
|
||||
namespace SM2D.Scene
|
||||
{
|
||||
|
|
@ -7,16 +8,16 @@ namespace SM2D.Scene
|
|||
{
|
||||
public override bool Orthographic { get; } = true;
|
||||
|
||||
public Vector2 Position;
|
||||
public Vector2 Position = new Vector2(0);
|
||||
|
||||
public override Matrix4 ViewCalculation()
|
||||
protected override Matrix4 ViewCalculation()
|
||||
{
|
||||
return Matrix4.LookAt(Position.X, Position.Y, -1, Position.X, Position.Y, 0, 0, 1, 0);
|
||||
}
|
||||
|
||||
public override void RecalculateWorld(float width, float height)
|
||||
public override void RecalculateWorld(OpenTK.Vector2 world, float aspect)
|
||||
{
|
||||
OrthographicWorld = Matrix4.CreateOrthographicOffCenter(-width / 2, width / 2, height / 2, -height / 2, 0.1f, 100);
|
||||
OrthographicWorld = Matrix4.CreateOrthographicOffCenter(world.X / 2, -world.X / 2, world.Y / 2, -world.Y / 2, 0.1f, 100);
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue