Functional level generation + moving the submarine

This commit is contained in:
Regalis
2015-06-26 23:05:51 +03:00
parent bda9b31cbe
commit 9237a9efe2
48 changed files with 1629 additions and 750 deletions
+14 -9
View File
@@ -15,10 +15,12 @@ namespace Subsurface
/// </summary>
class Game1 : Game
{
GraphicsDeviceManager graphics;
public static GraphicsDeviceManager graphics;
static int graphicsWidth, graphicsHeight;
static SpriteBatch spriteBatch;
public static GraphicsDevice CurrGraphicsDevice;
public static FrameCounter frameCounter;
public static readonly Version version = Assembly.GetEntryAssembly().GetName().Version;
@@ -46,7 +48,7 @@ namespace Subsurface
public static Random localRandom;
public static Random random;
private Stopwatch renderTimer;
//private Stopwatch renderTimer;
public static int renderTimeElapsed;
@@ -55,6 +57,7 @@ namespace Subsurface
get { return GameScreen.Cam; }
}
public static int GraphicsWidth
{
get { return graphicsWidth; }
@@ -68,7 +71,7 @@ namespace Subsurface
public Game1()
{
graphics = new GraphicsDeviceManager(this);
graphicsWidth = 1280;
graphicsHeight = 720;
@@ -76,13 +79,13 @@ namespace Subsurface
graphics.PreferredBackBufferWidth = graphicsWidth;
graphics.PreferredBackBufferHeight = graphicsHeight;
Content.RootDirectory = "Content";
//graphics.SynchronizeWithVerticalRetrace = false;
//graphics.ApplyChanges();
frameCounter = new FrameCounter();
renderTimer = new Stopwatch();
//renderTimer = new Stopwatch();
IsMouseVisible = true;
@@ -107,6 +110,8 @@ namespace Subsurface
{
base.Initialize();
CurrGraphicsDevice = GraphicsDevice;
particleManager = new ParticleManager("Content/Particles/prefabs.xml", Cam);
GameMode.Init();
@@ -145,7 +150,7 @@ namespace Subsurface
AmbientSoundManager.Init("Content/Sounds/Sounds.xml");
Map.PreloadMaps("Content/SavedMaps");
Submarine.Preload("Content/SavedMaps");
GameScreen = new GameScreen(graphics.GraphicsDevice);
MainMenuScreen = new MainMenuScreen(this);
LobbyScreen = new LobbyScreen();
@@ -209,7 +214,7 @@ namespace Subsurface
/// </summary>
protected override void Draw(GameTime gameTime)
{
renderTimer.Restart();
//renderTimer.Restart();
double deltaTime = gameTime.ElapsedGameTime.TotalSeconds;
@@ -217,8 +222,8 @@ namespace Subsurface
Screen.Selected.Draw(deltaTime, GraphicsDevice, spriteBatch);
renderTimeElapsed = (int)renderTimer.Elapsed.Ticks;
renderTimer.Stop();
//renderTimeElapsed = (int)renderTimer.Elapsed.Ticks;
//renderTimer.Stop();
}
protected override void OnExiting(object sender, EventArgs args)