Esempio n. 1
0
        public static void InitialiseGameSystems()
        {
            SystemCore.GraphicsDevice = SystemCore.GraphicsDeviceManager.GraphicsDevice;

            DebugShapeRenderer.Initialize(SystemCore.GraphicsDevice);
            SystemCore.GraphicsDeviceManager.ApplyChanges();



            InstantiateSystems();

            SystemCore.ContentManager.RootDirectory = "";

            SystemCore.Viewport          = SystemCore.GraphicsDevice.Viewport;
            SystemCore.ScreenManager     = GetSubsystem <ScreenManager>();
            SystemCore.GUIManager        = GetSubsystem <GUIManager>();
            SystemCore.GameObjectManager = GetSubsystem <GameObjectManager>();
            SystemCore.AudioManager      = GetSubsystem <AudioManager>();
            SystemCore.Input             = GetSubsystem <InputManager>();
            SystemCore.Game.Exiting     += (x, y) => { GameExiting = true; };

            PhysicsSimulation = new Space();

            if (PhysicsOnBackgroundThread)
            {
                PhysicsSimulation.SpaceObjectBuffer.Enabled = true;
                Thread t = new Thread(PhysicsUpdate);
                t.IsBackground = true;
                t.Start();
            }

            foreach (var gameSubSystem in gameSubSystems)
            {
                gameSubSystem.Initalise();
            }

            SystemCore.SetActiveCamera(new DummyCamera(MathHelper.PiOver4, GraphicsDevice.Viewport.AspectRatio, 0.3f,
                                                       1000.0f));

            DebugText.InjectDebugFont(GUIFonts.Fonts["test"]);
            DebugText.InjectGraphicsDevice(SystemCore.GraphicsDevice);


            EventManager = new EventManager();

            ShadowMapRenderer = new ShadowMapRenderer();
        }