From 3c44a52a8ff823d6024454d9d0e12fdd02768217 Mon Sep 17 00:00:00 2001 From: Recrown Date: Sun, 11 Nov 2018 14:44:30 -0600 Subject: [PATCH] reorganization, and skeleton of camera system. --- RhythmBullet/RhythmBullet.csproj | 1 + RhythmBullet/RhythmBulletGame.cs | 2 +- .../Zer01HD/Game/Screens/MainScreen.cs | 3 +-- .../Screens/Transitions/FadeAwayTransition.cs | 2 +- .../Zer01HD/Utilities/Camera/Camera2D.cs | 25 +++++++++++++++++++ .../Utilities/ScreenSystem/ITransition.cs | 2 +- .../Utilities/ScreenSystem/LoadingScreen.cs | 2 +- .../Zer01HD/Utilities/ScreenSystem/Screen.cs | 2 +- RhythmBullet/packages.config | 1 - 9 files changed, 32 insertions(+), 8 deletions(-) create mode 100644 RhythmBullet/Zer01HD/Utilities/Camera/Camera2D.cs diff --git a/RhythmBullet/RhythmBullet.csproj b/RhythmBullet/RhythmBullet.csproj index a319ef4..df472e0 100644 --- a/RhythmBullet/RhythmBullet.csproj +++ b/RhythmBullet/RhythmBullet.csproj @@ -48,6 +48,7 @@ + diff --git a/RhythmBullet/RhythmBulletGame.cs b/RhythmBullet/RhythmBulletGame.cs index d7c8bdc..963e444 100644 --- a/RhythmBullet/RhythmBulletGame.cs +++ b/RhythmBullet/RhythmBulletGame.cs @@ -8,7 +8,7 @@ using RhythmBullet.Zer01HD.Utilities; using RhythmBullet.Zer01HD.Utilities.ContentSystem; using RhythmBullet.Zer01HD.Utilities.DataTypes; using RhythmBullet.Zer01HD.Utilities.Input; -using RhythmBullet.Zer01HD.Utilities.UI.ScreenSystem; +using RhythmBullet.Zer01HD.Utilities.ScreenSystem; using System; using System.Diagnostics; diff --git a/RhythmBullet/Zer01HD/Game/Screens/MainScreen.cs b/RhythmBullet/Zer01HD/Game/Screens/MainScreen.cs index 199ed27..1bb2986 100644 --- a/RhythmBullet/Zer01HD/Game/Screens/MainScreen.cs +++ b/RhythmBullet/Zer01HD/Game/Screens/MainScreen.cs @@ -4,7 +4,7 @@ using RhythmBullet.Zer01HD.Game.Screens.Transitions; using RhythmBullet.Zer01HD.UI; using RhythmBullet.Zer01HD.Utilities.ContentSystem; using RhythmBullet.Zer01HD.Utilities.UI; -using RhythmBullet.Zer01HD.Utilities.UI.ScreenSystem; +using RhythmBullet.Zer01HD.Utilities.ScreenSystem; using System; using System.Collections.Generic; using System.Diagnostics; @@ -18,7 +18,6 @@ namespace RhythmBullet.Zer01HD.Game.Screens { FadeAwayTransition fat; Texture2D background; - Viewport viewport; public MainScreen(ContentSystem assets) : base(true) { diff --git a/RhythmBullet/Zer01HD/Game/Screens/Transitions/FadeAwayTransition.cs b/RhythmBullet/Zer01HD/Game/Screens/Transitions/FadeAwayTransition.cs index 2cad107..b722c0b 100644 --- a/RhythmBullet/Zer01HD/Game/Screens/Transitions/FadeAwayTransition.cs +++ b/RhythmBullet/Zer01HD/Game/Screens/Transitions/FadeAwayTransition.cs @@ -1,7 +1,7 @@ using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using RhythmBullet.Zer01HD.Utilities.UI; -using RhythmBullet.Zer01HD.Utilities.UI.ScreenSystem; +using RhythmBullet.Zer01HD.Utilities.ScreenSystem; using System; using System.Collections.Generic; using System.Diagnostics; diff --git a/RhythmBullet/Zer01HD/Utilities/Camera/Camera2D.cs b/RhythmBullet/Zer01HD/Utilities/Camera/Camera2D.cs new file mode 100644 index 0000000..592ff9a --- /dev/null +++ b/RhythmBullet/Zer01HD/Utilities/Camera/Camera2D.cs @@ -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)); + } + } +} diff --git a/RhythmBullet/Zer01HD/Utilities/ScreenSystem/ITransition.cs b/RhythmBullet/Zer01HD/Utilities/ScreenSystem/ITransition.cs index 2322b47..3ae93a3 100644 --- a/RhythmBullet/Zer01HD/Utilities/ScreenSystem/ITransition.cs +++ b/RhythmBullet/Zer01HD/Utilities/ScreenSystem/ITransition.cs @@ -6,7 +6,7 @@ using System.Linq; using System.Text; using System.Threading.Tasks; -namespace RhythmBullet.Zer01HD.Utilities.UI.ScreenSystem +namespace RhythmBullet.Zer01HD.Utilities.ScreenSystem { public interface ITransition { diff --git a/RhythmBullet/Zer01HD/Utilities/ScreenSystem/LoadingScreen.cs b/RhythmBullet/Zer01HD/Utilities/ScreenSystem/LoadingScreen.cs index 7cde380..82ee1d5 100644 --- a/RhythmBullet/Zer01HD/Utilities/ScreenSystem/LoadingScreen.cs +++ b/RhythmBullet/Zer01HD/Utilities/ScreenSystem/LoadingScreen.cs @@ -3,7 +3,7 @@ using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using System; -namespace RhythmBullet.Zer01HD.Utilities.UI.ScreenSystem +namespace RhythmBullet.Zer01HD.Utilities.ScreenSystem { class LoadingScreen : Screen, ITransition { diff --git a/RhythmBullet/Zer01HD/Utilities/ScreenSystem/Screen.cs b/RhythmBullet/Zer01HD/Utilities/ScreenSystem/Screen.cs index 8526435..6730c48 100644 --- a/RhythmBullet/Zer01HD/Utilities/ScreenSystem/Screen.cs +++ b/RhythmBullet/Zer01HD/Utilities/ScreenSystem/Screen.cs @@ -6,7 +6,7 @@ using System.Linq; using System.Text; using System.Threading.Tasks; -namespace RhythmBullet.Zer01HD.Utilities.UI.ScreenSystem +namespace RhythmBullet.Zer01HD.Utilities.ScreenSystem { public enum ScreenState { EnterTransition, ExitTransition, Normal } diff --git a/RhythmBullet/packages.config b/RhythmBullet/packages.config index 5ab82a4..12407c1 100644 --- a/RhythmBullet/packages.config +++ b/RhythmBullet/packages.config @@ -1,6 +1,5 @@  - \ No newline at end of file