From ced3d03bdb3ce866d832e03fb212865140905a9a Mon Sep 17 00:00:00 2001 From: Thomas Leyh Date: Sun, 24 Jul 2016 08:14:18 +0200 Subject: Add project files. --- V3/V3Game.cs | 78 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 78 insertions(+) create mode 100644 V3/V3Game.cs (limited to 'V3/V3Game.cs') diff --git a/V3/V3Game.cs b/V3/V3Game.cs new file mode 100644 index 0000000..ea7abbf --- /dev/null +++ b/V3/V3Game.cs @@ -0,0 +1,78 @@ +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Ninject; +using V3.Data; +using V3.Screens; + +namespace V3 +{ + /// + /// This is the main type for your game. + /// + public sealed class V3Game : Game + { + private readonly IKernel mKernel; + private SpriteBatch mSpriteBatch; + private IScreenManager mScreenManager; + private IScreen mMainScreen; + //private float mReculate = 1.0f; + /// + /// Creates a new V3 game instance. + /// + public V3Game() + { + mKernel = new StandardKernel(new Bindings(this, new GraphicsDeviceManager(this))); + IsMouseVisible = true; + } + + /// + /// Allows the game to perform any initialization it needs to before starting to run. + /// This is where it can query for any required services and load any non-graphic + /// related content. Calling base.Initialize will enumerate through any components + /// and initialize them as well. + /// + protected override void Initialize() + { + Content.RootDirectory = "Content"; + mKernel.Get().CreateMissingDirectories(); + mScreenManager = mKernel.Get(); + base.Initialize(); + } + + /// + /// LoadContent will be called once per game and is the place to load + /// all of your content. + /// + protected override void LoadContent() + { + // Create a new SpriteBatch, which can be used to draw textures. + mSpriteBatch = new SpriteBatch(GraphicsDevice); + mMainScreen = mKernel.Get().CreateMainScreen(); + mScreenManager.AddScreen(mMainScreen); + + } + + /// + /// Allows the game to run logic such as updating the world, + /// checking for collisions, gathering input, and playing audio. + /// It delegates the update to the screen manager. + /// + /// Provides a snapshot of timing values. + protected override void Update(GameTime gameTime) + { + mScreenManager.Update(gameTime); + base.Update(gameTime); + } + + /// + /// This is called when the game should draw itself. It delegates the + /// drawing to the screen manager. + /// + /// Provides a snapshot of timing values. + protected override void Draw(GameTime gameTime) + { + mScreenManager.Draw(gameTime, mSpriteBatch); + base.Draw(gameTime); + } + } +} -- cgit v1.2.1