Example #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()
        {
            AIParams.SetUpAIParams(Path.Combine(Directory.GetCurrentDirectory(), "AIConfig.txt"));

            device      = graphics.GraphicsDevice;
            spriteBatch = new SpriteBatch(device);

            world = new World(this);


            _windowWidth  = 1000; // GraphicsDevice.DisplayMode.Width / 2;
            _windowHeight = 600;  // GraphicsDevice.DisplayMode.Height / 2;

            // Setup frame buffer.
            graphics.SynchronizeWithVerticalRetrace = false;
            graphics.PreferredBackBufferWidth       = _windowWidth;
            graphics.PreferredBackBufferHeight      = _windowHeight;
            graphics.PreferMultiSampling            = true;
            graphics.ApplyChanges();

            // Setup the initial input states.
            currentKeyboardState = Keyboard.GetState();

            // Setup Fog
            // NOTE: migration to XNA 4.0
            // NOTE: graphics.GraphicsDevice.RenderState.FogStart = Settings.FOG_START;
            // NOTE: graphics.GraphicsDevice.RenderState.FogEnd = Settings.FOG_END;
            // NOTE: graphics.GraphicsDevice.RenderState.FogDensity = Settings.FOG_DENSITY;
            // NOTE: graphics.GraphicsDevice.RenderState.FogColor = Settings.FOG_COLOR;
            // NOTE: graphics.GraphicsDevice.RenderState.FogTableMode = Settings.FOG_MODE;
            // NOTE: graphics.GraphicsDevice.RenderState.FogVertexMode = Settings.FOG_MODE;

            HUD      = new ScreenOutput.HUD();
            _console = new ScreenOutput.Console();
            cursor   = new Cursor(this, device, spriteBatch);
            Components.Add(cursor);
            camera = new CameraComponent(this);
            Components.Add(camera);

            // NOTE: migration to XNA 4.0 basicEffect = new BasicEffect(graphics.GraphicsDevice, null);
            basicEffect = new BasicEffect(graphics.GraphicsDevice);

            base.Initialize();
        }
Example #2
0
        private void ToggleFullScreen()
        {
            int newWidth  = 0;
            int newHeight = 0;

            graphics.IsFullScreen = !graphics.IsFullScreen;

            if (graphics.IsFullScreen)
            {
                newWidth  = GraphicsDevice.DisplayMode.Width;
                newHeight = GraphicsDevice.DisplayMode.Height;
            }
            else
            {
                newWidth  = _windowWidth;
                newHeight = _windowHeight;
            }

            graphics.PreferredBackBufferWidth  = newWidth;
            graphics.PreferredBackBufferHeight = newHeight;
            graphics.ApplyChanges();
            Console = new ScreenOutput.Console();
            _console.Show();
        }
Example #3
0
        private void ToggleFullScreen()
        {
            int newWidth = 0;
            int newHeight = 0;

            graphics.IsFullScreen = !graphics.IsFullScreen;

            if (graphics.IsFullScreen)
            {
                newWidth = GraphicsDevice.DisplayMode.Width;
                newHeight = GraphicsDevice.DisplayMode.Height;
            }
            else
            {
                newWidth = _windowWidth;
                newHeight = _windowHeight;
            }

            graphics.PreferredBackBufferWidth = newWidth;
            graphics.PreferredBackBufferHeight = newHeight;
            graphics.ApplyChanges();
            Console = new ScreenOutput.Console();
            _console.Show();
        }
Example #4
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()
        {
            AIParams.SetUpAIParams(Path.Combine(Directory.GetCurrentDirectory(), "AIConfig.txt"));

            device = graphics.GraphicsDevice;
            spriteBatch = new SpriteBatch(device);

            world = new World(this);

            _windowWidth = 1000;// GraphicsDevice.DisplayMode.Width / 2;
            _windowHeight = 600;// GraphicsDevice.DisplayMode.Height / 2;

            // Setup frame buffer.
            graphics.SynchronizeWithVerticalRetrace = false;
            graphics.PreferredBackBufferWidth = _windowWidth;
            graphics.PreferredBackBufferHeight = _windowHeight;
            graphics.PreferMultiSampling = true;
            graphics.ApplyChanges();

            // Setup the initial input states.
            currentKeyboardState = Keyboard.GetState();

            // Setup Fog
            // NOTE: migration to XNA 4.0
            // NOTE: graphics.GraphicsDevice.RenderState.FogStart = Settings.FOG_START;
            // NOTE: graphics.GraphicsDevice.RenderState.FogEnd = Settings.FOG_END;
            // NOTE: graphics.GraphicsDevice.RenderState.FogDensity = Settings.FOG_DENSITY;
            // NOTE: graphics.GraphicsDevice.RenderState.FogColor = Settings.FOG_COLOR;
            // NOTE: graphics.GraphicsDevice.RenderState.FogTableMode = Settings.FOG_MODE;
            // NOTE: graphics.GraphicsDevice.RenderState.FogVertexMode = Settings.FOG_MODE;

            HUD = new ScreenOutput.HUD();
            _console = new ScreenOutput.Console();
            cursor = new Cursor(this, device, spriteBatch);
            Components.Add(cursor);
            camera = new CameraComponent(this);
            Components.Add(camera);

            // NOTE: migration to XNA 4.0 basicEffect = new BasicEffect(graphics.GraphicsDevice, null);
            basicEffect = new BasicEffect(graphics.GraphicsDevice);

            base.Initialize();
        }