reorganization, and skeleton of camera system.
This commit is contained in:
25
RhythmBullet/Zer01HD/Utilities/Camera/Camera2D.cs
Normal file
25
RhythmBullet/Zer01HD/Utilities/Camera/Camera2D.cs
Normal file
@@ -0,0 +1,25 @@
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace RhythmBullet.Zer01HD.Utilities.Camera
|
||||
{
|
||||
class Camera2D
|
||||
{
|
||||
public float Zoom;
|
||||
public Vector2 Position;
|
||||
public Matrix Transform { get; private set; }
|
||||
|
||||
public void Update(Viewport viewport)
|
||||
{
|
||||
Transform =
|
||||
Matrix.CreateTranslation(new Vector3(Position.X, Position.Y, 0)) *
|
||||
Matrix.CreateScale(Zoom) *
|
||||
Matrix.CreateTranslation(new Vector3(viewport.Width/2f, viewport.Height/2f, 0f));
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user