Browse Source

Changes to make the rendering a bit more plaform independent.

Dominique Louis 1 tháng trước cách đây
mục cha
commit
35c786dbd1

+ 2 - 2
RolePlayingGame/Core/AudioManager.cs

@@ -52,13 +52,13 @@ namespace RolePlaying
             string soundBankFile)
             : base(game)
         {
-            /*try
+            try
             {
                 audioEngine = new AudioEngine(settingsFile);
                 waveBank = new WaveBank(audioEngine, waveBankFile);
                 soundBank = new SoundBank(audioEngine, soundBankFile);
             }
-            catch (NoAudioHardwareException)*/
+            catch (NoAudioHardwareException)
             {
                 // silently fall back to silence
                 audioEngine = null;

+ 4 - 5
RolePlayingGame/Core/Combat/CombatEngine.cs

@@ -1048,17 +1048,16 @@ namespace RolePlaying
         private void DrawSelectionSprites(GameTime gameTime)
         {
             SpriteBatch spriteBatch = Session.ScreenManager.SpriteBatch;
-            Viewport viewport = Session.ScreenManager.GraphicsDevice.Viewport;
 
             // draw the highlighted-player sprite, if any
             if (highlightedCombatant != null)
             {
                 highlightBackgroundSprite.Draw(spriteBatch,
                     highlightedCombatant.Position,
-                    1f - (highlightedCombatant.Position.Y - 1) / viewport.Height);
+                    1f - (highlightedCombatant.Position.Y - 1) / Session.BACK_BUFFER_HEIGHT);
                 highlightForegroundSprite.Draw(spriteBatch,
                     highlightedCombatant.Position,
-                    1f - (highlightedCombatant.Position.Y + 1) / viewport.Height);
+                    1f - (highlightedCombatant.Position.Y + 1) / Session.BACK_BUFFER_HEIGHT);
             }
 
             // update the animations
@@ -1073,7 +1072,7 @@ namespace RolePlaying
             {
                 primaryTargetSprite.Draw(spriteBatch,
                     primaryTargetedCombatant.Position,
-                    1f - (primaryTargetedCombatant.Position.Y - 1) / viewport.Height);
+                    1f - (primaryTargetedCombatant.Position.Y - 1) / Session.BACK_BUFFER_HEIGHT);
                 if (primaryTargetedCombatant.Character is Monster)
                 {
                     Fonts.DrawCenteredText(spriteBatch, Fonts.DamageFont,
@@ -1098,7 +1097,7 @@ namespace RolePlaying
                 }
                 secondaryTargetSprite.Draw(spriteBatch,
                     combatant.Position,
-                    1f - (combatant.Position.Y - 1) / viewport.Height);
+                    1f - (combatant.Position.Y - 1) / Session.BACK_BUFFER_HEIGHT);
                 if (combatant.Character is Monster)
                 {
                     Fonts.DrawCenteredText(spriteBatch, Fonts.DamageFont,

+ 6 - 9
RolePlayingGame/Core/GameScreens/DialogueScreen.cs

@@ -198,33 +198,30 @@ namespace RolePlaying
             lineTexture =
                 content.Load<Texture2D>(@"Textures\GameScreens\SeparationLine");
 
-            Viewport viewport = ScreenManager.GraphicsDevice.Viewport;
+            backgroundPosition.X = (Session.BACK_BUFFER_WIDTH - backgroundTexture.Width) / 2;
+            backgroundPosition.Y = (Session.BACK_BUFFER_HEIGHT - backgroundTexture.Height) / 2;
 
-            backgroundPosition.X = (viewport.Width - backgroundTexture.Width) / 2;
-            backgroundPosition.Y = (viewport.Height - backgroundTexture.Height) / 2;
 
-
-            selectButtonPosition.X = viewport.Width / 2 + 260;
+            selectButtonPosition.X = Session.BACK_BUFFER_WIDTH / 2 + 260;
             selectButtonPosition.Y = backgroundPosition.Y + 530f;
             selectPosition.X = selectButtonPosition.X -
                 Fonts.ButtonNamesFont.MeasureString(selectText).X - 10f;
             selectPosition.Y = selectButtonPosition.Y;
 
-            backPosition.X = viewport.Width / 2 - 250f;
+            backPosition.X = Session.BACK_BUFFER_WIDTH / 2 - 250f;
             backPosition.Y = backgroundPosition.Y + 530f;
             backButtonPosition.X = backPosition.X - backButtonTexture.Width - 10;
             backButtonPosition.Y = backPosition.Y;
 
             scrollPosition = backgroundPosition + new Vector2(820f, 200f);
 
-            topLinePosition.X = (viewport.Width - lineTexture.Width) / 2 - 30f;
+            topLinePosition.X = (Session.BACK_BUFFER_WIDTH - lineTexture.Width) / 2 - 30f;
             topLinePosition.Y = 200f;
 
             bottomLinePosition.X = topLinePosition.X;
             bottomLinePosition.Y = 550f;
 
-            titlePosition.X = (viewport.Width -
-                Fonts.HeaderFont.MeasureString(titleText).X) / 2;
+            titlePosition.X = (Session.BACK_BUFFER_WIDTH - Fonts.HeaderFont.MeasureString(titleText).X) / 2;
             titlePosition.Y = backgroundPosition.Y + 70f;
         }
 

+ 5 - 11
RolePlayingGame/Core/GameScreens/GameOverScreen.cs

@@ -66,35 +66,29 @@ namespace RolePlaying
         public override void LoadContent()
         {
             ContentManager content = ScreenManager.Game.Content;
-            Viewport viewport = ScreenManager.GraphicsDevice.Viewport;
 
             fadeTexture = content.Load<Texture2D>(@"Textures\GameScreens\FadeScreen");
             backTexture = content.Load<Texture2D>(@"Textures\GameScreens\PopupScreen");
             selectIconTexture = content.Load<Texture2D>(@"Textures\Buttons\AButton");
 
-            backgroundPosition.X = (viewport.Width - backTexture.Width) / 2;
-            backgroundPosition.Y = (viewport.Height - backTexture.Height) / 2;
+            backgroundPosition.X = (Session.BACK_BUFFER_WIDTH - backTexture.Width) / 2;
+            backgroundPosition.Y = (Session.BACK_BUFFER_HEIGHT - backTexture.Height) / 2;
 
-            titlePosition.X = (viewport.Width -
+            titlePosition.X = (Session.BACK_BUFFER_WIDTH -
                 Fonts.HeaderFont.MeasureString(titleString).X) / 2;
             titlePosition.Y = backgroundPosition.Y + 70f;
 
-            gameOverPosition.X = (viewport.Width -
+            gameOverPosition.X = (Session.BACK_BUFFER_WIDTH -
                 Fonts.ButtonNamesFont.MeasureString(titleString).X) / 2;
             gameOverPosition.Y = backgroundPosition.Y + backTexture.Height / 2;
 
-            selectIconPosition.X = viewport.Width / 2 + 260;
+            selectIconPosition.X = Session.BACK_BUFFER_WIDTH / 2 + 260;
             selectIconPosition.Y = backgroundPosition.Y + 530f;
             selectPosition.X = selectIconPosition.X -
                 Fonts.ButtonNamesFont.MeasureString(selectString).X - 10f;
             selectPosition.Y = backgroundPosition.Y + 530f;
         }
 
-
-
-
-
-
         /// <summary>
         /// Handles user input.
         /// </summary>

+ 6 - 7
RolePlayingGame/Core/GameScreens/InnScreen.cs

@@ -126,7 +126,6 @@ namespace RolePlaying
         /// <param name="screenHeight">Height of the screen</param>
         public override void LoadContent()
         {
-            Viewport viewport = ScreenManager.GraphicsDevice.Viewport;
             ContentManager content = ScreenManager.Game.Content;
 
             backgroundTexture = 
@@ -146,17 +145,17 @@ namespace RolePlaying
             goldIcon = content.Load<Texture2D>(@"Textures\GameScreens\GoldIcon");
             fadeTexture = content.Load<Texture2D>(@"Textures\GameScreens\FadeScreen");
 
-            screenRectangle = new Rectangle(viewport.X, viewport.Y,
-                viewport.Width, viewport.Height);
+            screenRectangle = new Rectangle(0, 0,
+                Session.BACK_BUFFER_WIDTH, Session.BACK_BUFFER_HEIGHT);
 
-            plankPosition = new Vector2((viewport.Width - plankTexture.Width) / 2, 67f);
+            plankPosition = new Vector2((Session.BACK_BUFFER_WIDTH - plankTexture.Width) / 2, 67f);
 
             backgroundPosition = new Vector2(
-                (viewport.Width - backgroundTexture.Width) / 2,
-                (viewport.Height - backgroundTexture.Height) / 2);
+                (Session.BACK_BUFFER_WIDTH - backgroundTexture.Width) / 2,
+                (Session.BACK_BUFFER_HEIGHT - backgroundTexture.Height) / 2);
 
             namePosition = new Vector2(
-                (viewport.Width - Fonts.HeaderFont.MeasureString(inn.Name).X) / 2, 95f);
+                (Session.BACK_BUFFER_WIDTH - Fonts.HeaderFont.MeasureString(inn.Name).X) / 2, 95f);
 
             selectTextPosition = selectIconPosition;
             selectTextPosition.X -= 

+ 4 - 5
RolePlayingGame/Core/GameScreens/LevelUpScreen.cs

@@ -145,12 +145,11 @@ namespace RolePlaying
             fadeTexture = 
                 content.Load<Texture2D>(@"Textures\GameScreens\FadeScreen");
 
-            Viewport viewport = ScreenManager.GraphicsDevice.Viewport;
-            backgroundPosition.X = (viewport.Width - backTexture.Width) / 2;
-            backgroundPosition.Y = (viewport.Height - backTexture.Height) / 2;
+            backgroundPosition.X = (Session.BACK_BUFFER_WIDTH - backTexture.Width) / 2;
+            backgroundPosition.Y = (Session.BACK_BUFFER_HEIGHT - backTexture.Height) / 2;
 
-            screenSize = new Vector2(viewport.Width, viewport.Height);
-            fadeDest = new Rectangle(0, 0, viewport.Width, viewport.Height);
+            screenSize = new Vector2(Session.BACK_BUFFER_WIDTH, Session.BACK_BUFFER_HEIGHT);
+            fadeDest = new Rectangle(0, 0, Session.BACK_BUFFER_WIDTH, Session.BACK_BUFFER_HEIGHT);
 
             titlePosition.X = (screenSize.X -
                 Fonts.HeaderFont.MeasureString(titleText).X) / 2;

+ 2 - 5
RolePlayingGame/Core/GameScreens/ListScreen.cs

@@ -261,9 +261,7 @@ namespace RolePlaying
                 content.Load<Texture2D>(@"Textures\Buttons\YButton");
 
             // calculate the centered positions
-            Viewport viewport = ScreenManager.GraphicsDevice.Viewport;
-            plankTexturePosition = new Vector2(
-                viewport.X + (viewport.Width - plankTexture.Width) / 2f, 67f);
+            plankTexturePosition = new Vector2((Session.BACK_BUFFER_WIDTH - plankTexture.Width) / 2f, 67f);
 
             // adjust positions for texture sizes
             if (backButtonTexture != null)
@@ -637,9 +635,8 @@ namespace RolePlaying
             if ((plankTexture != null) && !String.IsNullOrEmpty(titleText))
             {
                 Vector2 titleTextSize = Fonts.HeaderFont.MeasureString(titleText);
-                Viewport viewport = ScreenManager.GraphicsDevice.Viewport;
                 Vector2 position = new Vector2(
-                    (float)Math.Floor(viewport.X + viewport.Width / 2 -
+                    (float)Math.Floor(Session.BACK_BUFFER_WIDTH / 2 -
                     titleTextSize.X / 2f), 95f);
                 spriteBatch.Draw(plankTexture, plankTexturePosition, Color.White);
                 spriteBatch.DrawString(Fonts.HeaderFont, titleText, position, Fonts.TitleColor, MathHelper.ToRadians(-3.0f), Vector2.Zero, 1.0f, SpriteEffects.None, 0f);

+ 3 - 4
RolePlayingGame/Core/GameScreens/PlayerSelectionScreen.cs

@@ -104,7 +104,6 @@ namespace RolePlaying
         /// </summary>
         public override void LoadContent()
         {
-            Viewport viewport = ScreenManager.GraphicsDevice.Viewport;
             ContentManager content = ScreenManager.Game.Content;
 
             fadeTexture = content.Load<Texture2D>(@"Textures\GameScreens\FadeScreen");
@@ -112,7 +111,7 @@ namespace RolePlaying
             // Display screens
             playerInfoScreen =
                 content.Load<Texture2D>(@"Textures\GameScreens\PopupScreen");
-            popupPosition = new Vector2(viewport.Width / 2f, viewport.Height / 2f);
+            popupPosition = new Vector2((Session.BACK_BUFFER_WIDTH / 2f), (Session.BACK_BUFFER_HEIGHT / 2f));
             popupPosition.X -= playerInfoScreen.Width / 2;
             popupPosition.Y -= playerInfoScreen.Height / 2;
 
@@ -129,8 +128,8 @@ namespace RolePlaying
                 content.Load<Texture2D>(@"Textures\GameScreens\PlayerUnSelected");
 
             titlePosition = new Vector2(
-                (viewport.Width - Fonts.HeaderFont.MeasureString("Choose Player").X) / 2,
-                (viewport.Height - playerInfoScreen.Height) / 2 + 70f);
+                (Session.BACK_BUFFER_WIDTH - Fonts.HeaderFont.MeasureString("Choose Player").X) / 2,
+                (Session.BACK_BUFFER_HEIGHT - playerInfoScreen.Height) / 2 + 70f);
         }
 
 

+ 5 - 7
RolePlayingGame/Core/GameScreens/QuestDetailsScreen.cs

@@ -78,7 +78,6 @@ namespace RolePlaying
         public override void LoadContent()
         {
             ContentManager content = ScreenManager.Game.Content;
-            Viewport viewport = ScreenManager.GraphicsDevice.Viewport;
 
             backgroundTexture =
                 content.Load<Texture2D>(@"Textures\GameScreens\PopupScreen");
@@ -91,13 +90,12 @@ namespace RolePlaying
             fadeTexture = content.Load<Texture2D>(@"Textures\GameScreens\FadeScreen");
 
             // Get the screen positions
-            screenSize = new Vector2(viewport.Width, viewport.Height);
-            fadeDest = new Rectangle(viewport.X, viewport.Y,
-                viewport.Width, viewport.Height);
+            screenSize = new Vector2(Session.BACK_BUFFER_WIDTH, Session.BACK_BUFFER_HEIGHT);
+            fadeDest = new Rectangle(0, 0, Session.BACK_BUFFER_WIDTH, Session.BACK_BUFFER_HEIGHT);
 
             backgroundPosition = new Vector2(
-                (viewport.Width - backgroundTexture.Width) / 2,
-                (viewport.Height - backgroundTexture.Height) / 2);
+                (Session.BACK_BUFFER_WIDTH - backgroundTexture.Width) / 2,
+                (Session.BACK_BUFFER_HEIGHT - backgroundTexture.Height) / 2);
             scrollPosition = backgroundPosition + new Vector2(820f, 200f);
 
             titlePosition = new Vector2(
@@ -110,7 +108,7 @@ namespace RolePlaying
                 backTextPosition.X - backIconTexture.Width - 10f, backTextPosition.Y);
 
             topLinePosition = new Vector2(
-                (viewport.Width - lineTexture.Width) / 2 - 30f, 200f);
+                (Session.BACK_BUFFER_WIDTH - lineTexture.Width) / 2 - 30f, 200f);
             bottomLinePosition = new Vector2(topLinePosition.X, 550f);
         }
 

+ 4 - 6
RolePlayingGame/Core/GameScreens/RewardsScreen.cs

@@ -168,13 +168,11 @@ namespace RolePlaying
                 content.Load<Texture2D>(@"Textures\GameScreens\SeparationLine");
             fadeTexture = content.Load<Texture2D>(@"Textures\GameScreens\FadeScreen");
 
-            Viewport viewport = ScreenManager.GraphicsDevice.Viewport;
-            fadeDest = new Rectangle(viewport.X, viewport.Y, viewport.Width,
-                viewport.Height);
-            backgroundPosition.X = (viewport.Width - backTexture.Width) / 2;
-            backgroundPosition.Y = (viewport.Height - backTexture.Height) / 2;
+            fadeDest = new Rectangle(0, 0, Session.BACK_BUFFER_WIDTH, Session.BACK_BUFFER_HEIGHT);
+            backgroundPosition.X = (Session.BACK_BUFFER_WIDTH - backTexture.Width) / 2;
+            backgroundPosition.Y = (Session.BACK_BUFFER_HEIGHT - backTexture.Height) / 2;
 
-            screenSize = new Vector2(viewport.Width, viewport.Height);
+            screenSize = new Vector2(Session.BACK_BUFFER_WIDTH, Session.BACK_BUFFER_HEIGHT);
 
             selectIconPosition.X = screenSize.X / 2 + 260;
             selectIconPosition.Y = backgroundPosition.Y + 530f;

+ 3 - 5
RolePlayingGame/Core/GameScreens/StatisticsScreen.cs

@@ -93,7 +93,6 @@ namespace RolePlaying
         public override void LoadContent()
         {
             ContentManager content = ScreenManager.Game.Content;
-            Viewport viewport = ScreenManager.GraphicsDevice.Viewport;
 
             statisticsScreen =
                 content.Load<Texture2D>(@"Textures\GameScreens\GameScreenBkgd");
@@ -120,14 +119,13 @@ namespace RolePlaying
             fadeTexture =
                 content.Load<Texture2D>(@"Textures\GameScreens\FadeScreen");
 
-            screenRectangle = new Rectangle(viewport.X, viewport.Y,
-                viewport.Width, viewport.Height);
+            screenRectangle = new Rectangle(0, 0, Session.BACK_BUFFER_WIDTH, Session.BACK_BUFFER_HEIGHT);
 
-            statisticsNamePosition.X = (viewport.Width -
+            statisticsNamePosition.X = (Session.BACK_BUFFER_WIDTH -
                 Fonts.HeaderFont.MeasureString("Statistics").X) / 2;
             statisticsNamePosition.Y = 95f;
 
-            plankPosition.X = (viewport.Width - plankTexture.Width) / 2;
+            plankPosition.X = (Session.BACK_BUFFER_WIDTH - plankTexture.Width) / 2;
             plankPosition.Y = 67f;
         }
 

+ 3 - 5
RolePlayingGame/Core/GameScreens/StoreScreen.cs

@@ -102,13 +102,11 @@ namespace RolePlaying
             plankTexture = 
                 content.Load<Texture2D>(@"Textures\MainMenu\MainMenuPlank03");
 
-            Viewport viewport = ScreenManager.GraphicsDevice.Viewport;
-            screenRect = new Rectangle(viewport.X, viewport.Y,
-                viewport.Width, viewport.Height);
+            screenRect = new Rectangle(0, 0, Session.BACK_BUFFER_WIDTH, Session.BACK_BUFFER_HEIGHT);
             plankPosition = new Vector2(
-                (viewport.Width - plankTexture.Width) / 2, 66f);
+                (Session.BACK_BUFFER_WIDTH - plankTexture.Width) / 2, 66f);
             shopNamePosition = new Vector2(
-                (viewport.Width - Fonts.HeaderFont.MeasureString(store.Name).X) / 2, 
+                (Session.BACK_BUFFER_WIDTH - Fonts.HeaderFont.MeasureString(store.Name).X) / 2, 
                 95f);
         }
 

+ 0 - 1
RolePlayingGame/Core/MenuScreens/ControlsScreen.cs

@@ -124,7 +124,6 @@ namespace RolePlaying
         /// </summary>
         public override void LoadContent()
         {
-            Viewport viewport = ScreenManager.GraphicsDevice.Viewport;
             keyboardInfo.totalActionList = InputManager.ActionMaps;
             keyboardInfo.selectedIndex = 0;
 

+ 5 - 10
RolePlayingGame/Core/MenuScreens/LoadingScreen.cs

@@ -88,13 +88,11 @@ namespace RolePlaying
             loadingTexture = content.Load<Texture2D>(@"Textures\MainMenu\LoadingPause");
             loadingBlackTexture =
                 content.Load<Texture2D>(@"Textures\GameScreens\FadeScreen");
-            Viewport viewport = ScreenManager.GraphicsDevice.Viewport;
-            loadingBlackTextureDestination = new Rectangle(viewport.X, viewport.Y, 
-                viewport.Width, viewport.Height);
-            loadingPosition = new Vector2(
-                viewport.X + (float)Math.Floor((viewport.Width - 
-                    loadingTexture.Width) / 2f),
-                viewport.Y + (float)Math.Floor((viewport.Height - 
+
+            loadingBlackTextureDestination = new Rectangle(0, 0, 
+                Session.BACK_BUFFER_WIDTH, Session.BACK_BUFFER_HEIGHT);
+            loadingPosition = new Vector2((float)Math.Floor((Session.BACK_BUFFER_WIDTH - 
+                    loadingTexture.Width) / 2f), (float)Math.Floor((Session.BACK_BUFFER_HEIGHT -
                     loadingTexture.Height) / 2f));
 
             base.LoadContent();
@@ -160,9 +158,6 @@ namespace RolePlaying
                 SpriteBatch spriteBatch = ScreenManager.SpriteBatch;
 
                 // Center the text in the viewport.
-                Viewport viewport = ScreenManager.GraphicsDevice.Viewport;
-                Vector2 viewportSize = new Vector2(viewport.Width, viewport.Height);
-
                 Color color = new Color((byte)255, (byte)255, (byte)255, TransitionAlpha);
 
                 spriteBatch.Begin(SpriteSortMode.Deferred, null, null, null, null, null, ScreenManager.GlobalTransformation);

+ 2 - 3
RolePlayingGame/Core/MenuScreens/MainMenuScreen.cs

@@ -138,10 +138,9 @@ namespace RolePlaying
             selectTexture = content.Load<Texture2D>(@"Textures\Buttons\AButton");
 
             // calculate the texture positions
-            Viewport viewport = ScreenManager.GraphicsDevice.Viewport;
             backgroundPosition = new Vector2(
-                (viewport.Width - backgroundTexture.Width) / 2,
-                (viewport.Height - backgroundTexture.Height) / 2);
+                (Session.BACK_BUFFER_WIDTH - backgroundTexture.Width) / 2,
+                (Session.BACK_BUFFER_HEIGHT - backgroundTexture.Height) / 2);
             descriptionAreaPosition = backgroundPosition + new Vector2(158, 130);
             descriptionAreaTextPosition = backgroundPosition + new Vector2(158, 350);
             iconPosition = backgroundPosition + new Vector2(170, 80);

+ 4 - 5
RolePlayingGame/Core/MenuScreens/MessageBoxScreen.cs

@@ -81,12 +81,11 @@ namespace RolePlaying
             loadingBlackTexture =
                 content.Load<Texture2D>(@"Textures\GameScreens\FadeScreen");
 
-            Viewport viewport = ScreenManager.GraphicsDevice.Viewport;
             backgroundPosition = new Vector2(
-                (viewport.Width - backgroundTexture.Width) / 2,
-                (viewport.Height - backgroundTexture.Height) / 2);
-            loadingBlackTextureDestination = new Rectangle(viewport.X, viewport.Y,
-                viewport.Width, viewport.Height);
+                (Session.BACK_BUFFER_WIDTH - backgroundTexture.Width) / 2,
+                (Session.BACK_BUFFER_HEIGHT - backgroundTexture.Height) / 2);
+            loadingBlackTextureDestination = new Rectangle(0, 0,
+                Session.BACK_BUFFER_WIDTH, Session.BACK_BUFFER_HEIGHT);
 
             backPosition = backgroundPosition + new Vector2(50f,
                 backgroundTexture.Height - 100);

+ 2 - 3
RolePlayingGame/Core/MenuScreens/SaveLoadScreen.cs

@@ -109,10 +109,9 @@ namespace RolePlaying
                 content.Load<Texture2D>(@"Textures\GameScreens\SelectionArrow");
 
             // calculate the image positions
-            Viewport viewport = ScreenManager.GraphicsDevice.Viewport;
             backgroundPosition = new Vector2(
-                (viewport.Width - backgroundTexture.Width) / 2,
-                (viewport.Height - backgroundTexture.Height) / 2); 
+                (Session.BACK_BUFFER_WIDTH - backgroundTexture.Width) / 2,
+                (Session.BACK_BUFFER_HEIGHT - backgroundTexture.Height) / 2);
             plankPosition = backgroundPosition + new Vector2(
                 backgroundTexture.Width / 2 - plankTexture.Width / 2, 
                 60f);

+ 1 - 1
RolePlayingGame/Core/RolePlayingGame.cs

@@ -92,7 +92,7 @@ namespace RolePlaying
 
             base.Initialize();
 
-            TileEngine.Viewport = graphicsDeviceManager.GraphicsDevice.Viewport;
+            TileEngine.Viewport = screenManager.GraphicsDevice.Viewport;
 
             screenManager.AddScreen(new MainMenuScreen());
         }

+ 1 - 3
RolePlayingGame/Core/ScreenManager/ScreenManager.cs

@@ -258,12 +258,10 @@ namespace RolePlaying
         /// <param name="alpha">The opacity level of the fade (0 = fully transparent, 1 = fully opaque).</param>
         public void FadeBackBufferToBlack(float alpha)
         {
-            Viewport viewport = GraphicsDevice.Viewport;
-
             spriteBatch.Begin(SpriteSortMode.Deferred, null, null, null, null, null, GlobalTransformation);
 
             spriteBatch.Draw(blankTexture,
-                             new Rectangle(0, 0, viewport.Width, viewport.Height),
+                             new Rectangle(0, 0, Session.BACK_BUFFER_WIDTH, Session.BACK_BUFFER_HEIGHT),
                              Color.Black * alpha);
 
             spriteBatch.End();