diff --git a/Subsurface/Source/GameMain.cs b/Subsurface/Source/GameMain.cs
index 4cb9f2492..7ca41b8b0 100644
--- a/Subsurface/Source/GameMain.cs
+++ b/Subsurface/Source/GameMain.cs
@@ -7,30 +7,15 @@ using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Barotrauma.Networking;
using Barotrauma.Particles;
-using System.Collections;
using System.Collections.Generic;
using Microsoft.Xna.Framework.Input;
-using System.Xml;
namespace Barotrauma
{
class GameMain : Game
{
- public static GraphicsDeviceManager Graphics;
- static int graphicsWidth, graphicsHeight;
- static SpriteBatch spriteBatch;
-
- public static GameMain Instance;
-
- public static bool WindowActive
- {
- get { return Instance == null || Instance.IsActive; }
- }
-
public static bool DebugDraw;
-
- public static GraphicsDevice CurrGraphicsDevice;
-
+
public static FrameCounter FrameCounter;
public static readonly Version Version = Assembly.GetEntryAssembly().GetName().Version;
@@ -51,21 +36,17 @@ namespace Barotrauma
{
get { return Config.SelectedContentPackage; }
}
-
- public static Level Level;
-
+
public static GameSession GameSession;
public static NetworkMember NetworkMember;
public static ParticleManager ParticleManager;
-
- //public static TextureLoader TextureLoader;
public static World World;
public static LoadingScreen TitleScreen;
- private static bool loadingScreenOpen;
+ private bool loadingScreenOpen;
public static GameSettings Config;
@@ -74,25 +55,35 @@ namespace Barotrauma
private GameTime fixedTime;
- //public static Random localRandom;
- //public static Random random;
+ private static SpriteBatch spriteBatch;
- //private Stopwatch renderTimer;
- //public static int renderTimeElapsed;
-
- public Camera Cam
+ public static GameMain Instance
{
- get { return GameScreen.Cam; }
+ get;
+ private set;
}
+ public static GraphicsDeviceManager GraphicsDeviceManager
+ {
+ get;
+ private set;
+ }
+
public static int GraphicsWidth
{
- get { return graphicsWidth; }
+ get;
+ private set;
}
public static int GraphicsHeight
{
- get { return graphicsHeight; }
+ get;
+ private set;
+ }
+
+ public static bool WindowActive
+ {
+ get { return Instance == null || Instance.IsActive; }
}
public static GameServer Server
@@ -122,7 +113,7 @@ namespace Barotrauma
public GameMain()
{
- Graphics = new GraphicsDeviceManager(this);
+ GraphicsDeviceManager = new GraphicsDeviceManager(this);
Window.Title = "Barotrauma";
@@ -141,11 +132,8 @@ namespace Barotrauma
Content.RootDirectory = "Content";
FrameCounter = new FrameCounter();
-
- //IsMouseVisible = true;
-
+
IsFixedTimeStep = false;
- //TargetElapsedTime = new TimeSpan(0, 0, 0, 0, 55);
Timing.Accumulator = 0.0f;
fixedTime = new GameTime();
@@ -155,22 +143,21 @@ namespace Barotrauma
FarseerPhysics.Settings.ContinuousPhysics = false;
FarseerPhysics.Settings.VelocityIterations = 1;
FarseerPhysics.Settings.PositionIterations = 1;
-
}
public void ApplyGraphicsSettings()
{
- graphicsWidth = Config.GraphicsWidth;
- graphicsHeight = Config.GraphicsHeight;
- Graphics.SynchronizeWithVerticalRetrace = Config.VSyncEnabled;
-
- Graphics.HardwareModeSwitch = Config.WindowMode != WindowMode.BorderlessWindowed;
+ GraphicsWidth = Config.GraphicsWidth;
+ GraphicsHeight = Config.GraphicsHeight;
+ GraphicsDeviceManager.SynchronizeWithVerticalRetrace = Config.VSyncEnabled;
- Graphics.IsFullScreen = Config.WindowMode == WindowMode.Fullscreen || Config.WindowMode == WindowMode.BorderlessWindowed;
- Graphics.PreferredBackBufferWidth = graphicsWidth;
- Graphics.PreferredBackBufferHeight = graphicsHeight;
-
- Graphics.ApplyChanges();
+ GraphicsDeviceManager.HardwareModeSwitch = Config.WindowMode != WindowMode.BorderlessWindowed;
+
+ GraphicsDeviceManager.IsFullScreen = Config.WindowMode == WindowMode.Fullscreen || Config.WindowMode == WindowMode.BorderlessWindowed;
+ GraphicsDeviceManager.PreferredBackBufferWidth = GraphicsWidth;
+ GraphicsDeviceManager.PreferredBackBufferHeight = GraphicsHeight;
+
+ GraphicsDeviceManager.ApplyChanges();
}
///
@@ -182,9 +169,7 @@ namespace Barotrauma
protected override void Initialize()
{
base.Initialize();
-
- CurrGraphicsDevice = GraphicsDevice;
-
+
ScissorTestEnable = new RasterizerState() { ScissorTestEnable = true };
Hyper.ComponentModel.HyperTypeDescriptionProvider.Add(typeof(Character));
@@ -199,25 +184,25 @@ namespace Barotrauma
///
protected override void LoadContent()
{
- graphicsWidth = GraphicsDevice.Viewport.Width;
- graphicsHeight = GraphicsDevice.Viewport.Height;
-
+ GraphicsWidth = GraphicsDevice.Viewport.Width;
+ GraphicsHeight = GraphicsDevice.Viewport.Height;
+
Sound.Init();
ConvertUnits.SetDisplayUnitToSimUnitRatio(Physics.DisplayToSimRation);
-
- spriteBatch = new SpriteBatch(GraphicsDevice);
- TextureLoader.Init(GraphicsDevice);
+
+ spriteBatch = new SpriteBatch(base.GraphicsDevice);
+ TextureLoader.Init(base.GraphicsDevice);
loadingScreenOpen = true;
- TitleScreen = new LoadingScreen(GraphicsDevice);
+ TitleScreen = new LoadingScreen(base.GraphicsDevice);
loadingCoroutine = CoroutineManager.StartCoroutine(Load());
}
public IEnumerable