From 87748e1f6cb0d3604784e9cd103d7504d3ac2dfc Mon Sep 17 00:00:00 2001 From: Dylan Wilson Date: Fri, 10 Jul 2015 09:23:37 +1000 Subject: [PATCH] renamed to camera2d --- MonoGame.Extended/Game1/Game1.cs | 7 +++---- .../MonoGame.Extended/{Camera.cs => Camera2D.cs} | 12 +++++++++--- .../MonoGame.Extended/MonoGame.Extended.csproj | 3 +-- .../MonoGame.Extended/OrthographicCamera.cs | 9 --------- 4 files changed, 13 insertions(+), 18 deletions(-) rename MonoGame.Extended/MonoGame.Extended/{Camera.cs => Camera2D.cs} (89%) delete mode 100644 MonoGame.Extended/MonoGame.Extended/OrthographicCamera.cs diff --git a/MonoGame.Extended/Game1/Game1.cs b/MonoGame.Extended/Game1/Game1.cs index d6a76f2c..0365921d 100644 --- a/MonoGame.Extended/Game1/Game1.cs +++ b/MonoGame.Extended/Game1/Game1.cs @@ -10,7 +10,7 @@ namespace Game1 private GraphicsDeviceManager _graphicsDeviceManager; private SpriteBatch _spriteBatch; private TextureRegion2D _textureRegion; - private OrthographicCamera _camera; + private Camera2D _camera; private Texture2D[] _backgroundTexture; private Texture2D _backgroundTextureClouds; private Texture2D _backgroundTextureSky; @@ -24,10 +24,9 @@ namespace Game1 protected override void Initialize() { - _camera = new OrthographicCamera + _camera = new Camera2D(GraphicsDevice.Viewport) { - Origin = new Vector2(GraphicsDevice.Viewport.Width / 2f, GraphicsDevice.Viewport.Height / 2f), - Zoom = 0.2f + Zoom = 0.5f }; base.Initialize(); } diff --git a/MonoGame.Extended/MonoGame.Extended/Camera.cs b/MonoGame.Extended/MonoGame.Extended/Camera2D.cs similarity index 89% rename from MonoGame.Extended/MonoGame.Extended/Camera.cs rename to MonoGame.Extended/MonoGame.Extended/Camera2D.cs index f20af413..a9085023 100644 --- a/MonoGame.Extended/MonoGame.Extended/Camera.cs +++ b/MonoGame.Extended/MonoGame.Extended/Camera2D.cs @@ -1,15 +1,21 @@ using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; namespace MonoGame.Extended { - public abstract class Camera : IMovable, IRotatable + public class Camera2D : IMovable, IRotatable { - protected Camera() + public Camera2D(Viewport viewport) + : this(viewport.Width, viewport.Height) + { + } + + public Camera2D(int viewportWidth, int viewportHeight) { Position = Vector2.Zero; Rotation = 0; Zoom = 1; - Origin = Vector2.Zero; + Origin = new Vector2(viewportWidth / 2f, viewportHeight / 2f); } public Vector2 Position { get; set; } diff --git a/MonoGame.Extended/MonoGame.Extended/MonoGame.Extended.csproj b/MonoGame.Extended/MonoGame.Extended/MonoGame.Extended.csproj index f341217e..ba341473 100644 --- a/MonoGame.Extended/MonoGame.Extended/MonoGame.Extended.csproj +++ b/MonoGame.Extended/MonoGame.Extended/MonoGame.Extended.csproj @@ -34,10 +34,9 @@ 4 - + - diff --git a/MonoGame.Extended/MonoGame.Extended/OrthographicCamera.cs b/MonoGame.Extended/MonoGame.Extended/OrthographicCamera.cs deleted file mode 100644 index 22c2566c..00000000 --- a/MonoGame.Extended/MonoGame.Extended/OrthographicCamera.cs +++ /dev/null @@ -1,9 +0,0 @@ -namespace MonoGame.Extended -{ - public class OrthographicCamera : Camera - { - public OrthographicCamera() - { - } - } -} \ No newline at end of file