Пример #1
0
        /// <summary>
        ///
        /// 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.
        /// </summary>
        protected override void Initialize()
        {
            SpriteDrawer.Initialize(graphics.GraphicsDevice);

            InventoryManager.ResetValues();
            AchievementManager.ResetValues();

            EntityManager.Initialize();

            base.Initialize();

            _currentState = new PlayState(_camera);
            _currentState.Create();

            _fpsLabel.Initialize();
        }
        private void Window_Initialized(object sender, EventArgs e)
        {
            MainPlayer.Initialize();
            float aspectRatio = (float)view1.Width / (float)view1.Height;

            Camera.CurrentBehavior = Behavior.Spectator;
            //Camera.Perspective((float)Math.PI / 4.0f, aspectRatio, 1.0f, 1000000.0f);
            Camera.Perspective((float)Math.PI / 4.0f, aspectRatio, 1.0f, 4000.0f);
            Camera.Position      = new Vector3(0, 0, 0);
            Camera.Velocity      = new Vector3(40.0f, 40.0f, 40.0f);
            Camera.RotationSpeed = 0.25f;
            WorldTime.Speed      = 0;

            //compile shaders
            List <BaseGameObject> shaders = WorldData.GetObjectsByType(typeof(Shader));

            foreach (Shader s in shaders)
            {
                s.Recompile();
            }



            SpriteDrawer.Initialize();
            DeferredRenderer.Initialize((int)view1.Width, (int)view1.Height);
            DeferredRenderer.RenderHeight = (int)view1.Height;
            DeferredRenderer.RenderWidth  = (int)view1.Width;
            SkyDome.Initialize();
            Rendering.Grid.Initialize();

            view1.OnRenderView += new EventHandler(view1_OnRender);
            view1.D3DScene      = new CellViewer((int)view1.Width, (int)view1.Height);
            view1.OnRenderView += new EventHandler(view1_OnRender);

            this.WindowState = System.Windows.WindowState.Maximized;


            GameData.LoadGameData();
            PhysicsEngine.Initialize();
            ScriptManager.Initialize();
        }
Пример #3
0
        /// <summary>
        ///
        /// 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.
        /// </summary>
        protected override void Initialize()
        {
#if OPENGL
            InitGraphics();
#endif

            _camera = new Camera();

            SpriteDrawer.Initialize(graphics.GraphicsDevice);

            GlobalState.ResetValues();

            EntityManager.Initialize();

            base.Initialize();

            SetState(GameState.TitleScreen);

            _fpsLabel = new UILabel(new Vector2(0, GameConstants.HEADER_HEIGHT), false, "", Color.LightBlue);

            GlobalState.darkness.SetCamera(_camera);
        }
Пример #4
0
        protected override void Initialize()
        {
            //GameWorld.Initialize(this.Window, GraphicsDeviceManager.ScreenWidth, GraphicsDeviceManager.ScreenHeight);
            //GameWorld.DeSerializeWorld(@"..\..\Content\export\World\physicsTest.world");

            PlayerInput.Initialize();
            float aspectRatio = (float)GraphicsDeviceManager.ScreenWidth / (float)GraphicsDeviceManager.ScreenHeight;

            Camera.CurrentBehavior = Behavior.Spectator;
            Camera.Perspective((float)Math.PI / 4.0f, aspectRatio, 1.0f, 1000000.0f);
            Camera.Position = new Vector3(0.0f, 10.0f, 0.0f);
            Camera.Velocity = new Vector3(40.0f, 40.0f, 40.0f);


            KeyboardInput.CreateDevice(this.Window);
            MouseInput.CreateDevice(this.Window);
            PrintText.Initialize();
            EffectManager.Initialize();
            SpriteDrawer.Initialize();
            DeferredRenderer.Initialize(GraphicsDeviceManager.ScreenWidth, GraphicsDeviceManager.ScreenHeight);

            SkyDome.Initialize();
            PhysicsEngine.Initialize();
        }