Beispiel #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()
        {
            Window = base.Window;
            Window.Title = "Sandvox";

            // Setup frame buffer.
            graphics.SynchronizeWithVerticalRetrace = false;
            graphics.PreferredBackBufferWidth = graphics.GraphicsDevice.Viewport.Width;
            graphics.PreferredBackBufferHeight = graphics.GraphicsDevice.Viewport.Height;
            graphics.PreferMultiSampling = true;
            graphics.GraphicsDevice.PresentationParameters.MultiSampleCount = 4;
            graphics.ApplyChanges();

            Mouse.SetPosition(graphics.GraphicsDevice.Viewport.Width / 2, graphics.GraphicsDevice.Viewport.Height / 2);
            originalMouseState = Mouse.GetState();
            // Initialize light settings.
            light.Type = Light.LightType.DirectionalLight;
            light.Direction = new Vector3(2, 3, 0);
            light.Radius = Math.Max(35, 25);
            light.Position = new Vector3(6.0f, 1.0f, 1.0f);
            light.Ambient = new Color(0.3f, 0.3f, 0.3f);
            light.Diffuse = new Color(0.9f, 0.9f, 0.9f);
            light.Specular = Color.White;
            light.SpotInnerConeRadians = MathHelper.ToRadians(30.0f);
            light.SpotOuterConeRadians = MathHelper.ToRadians(100.0f);

            light2.Type = Light.LightType.DirectionalLight;
            light2.Direction = new Vector3(6, 1, 5);
            light2.Radius = Math.Max(25, 50);
            light2.Ambient = new Color(0.7f, 0.7f, 0.7f);
            light2.Diffuse = new Color(0.8f, 0.8f, 0.8f);
            light2.Specular = Color.White;
            light2.Position = new Vector3(0, 0, 0);
            light2.SpotInnerConeRadians = MathHelper.ToRadians(30.0f);
            light2.SpotOuterConeRadians = MathHelper.ToRadians(100.0f);

            // Initialize material settings for the floor.
            material.Ambient = new Color(new Vector4(0.6f, 0.6f, 0.6f, 1.0f));
            material.Diffuse = new Color(new Vector4(0.7f, 0.7f, 0.7f, 1.0f));
            material.Emissive = Color.Black;
            material.Specular = Color.White;
            material.Shininess = 0.0f;

            // Parallax mapping height scale and bias values.
            scaleBias = new Vector2(0.04f, -0.03f);
            //player = new Player();
            reddit = new System.Drawing.Bitmap(@"C:\gamephotos\awesomeface.jpg");
            InitCamera();

            world = new World(this, 10);
            this.Components.Add(world);

            color = Color.OrangeRed;

            interp = new SandvoxInterpreter(this, Content.Load<SpriteFont>("ConsoleFont"));
            interp.AddGlobal("game", this);

            brush = new InstanceBrush("brush.txt");
            //Face.InitializeFaces();
            base.Initialize();
        }
Beispiel #2
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()
        {
            Window       = base.Window;
            Window.Title = "Sandvox";

            // Setup frame buffer.
            graphics.SynchronizeWithVerticalRetrace = false;
            graphics.PreferredBackBufferWidth       = graphics.GraphicsDevice.Viewport.Width;
            graphics.PreferredBackBufferHeight      = graphics.GraphicsDevice.Viewport.Height;
            graphics.PreferMultiSampling            = true;
            graphics.GraphicsDevice.PresentationParameters.MultiSampleCount = 4;
            graphics.ApplyChanges();

            Mouse.SetPosition(graphics.GraphicsDevice.Viewport.Width / 2, graphics.GraphicsDevice.Viewport.Height / 2);
            originalMouseState = Mouse.GetState();
            // Initialize light settings.
            light.Type                 = Light.LightType.DirectionalLight;
            light.Direction            = new Vector3(2, 3, 0);
            light.Radius               = Math.Max(35, 25);
            light.Position             = new Vector3(6.0f, 1.0f, 1.0f);
            light.Ambient              = new Color(0.3f, 0.3f, 0.3f);
            light.Diffuse              = new Color(0.9f, 0.9f, 0.9f);
            light.Specular             = Color.White;
            light.SpotInnerConeRadians = MathHelper.ToRadians(30.0f);
            light.SpotOuterConeRadians = MathHelper.ToRadians(100.0f);

            light2.Type                 = Light.LightType.DirectionalLight;
            light2.Direction            = new Vector3(6, 1, 5);
            light2.Radius               = Math.Max(25, 50);
            light2.Ambient              = new Color(0.7f, 0.7f, 0.7f);
            light2.Diffuse              = new Color(0.8f, 0.8f, 0.8f);
            light2.Specular             = Color.White;
            light2.Position             = new Vector3(0, 0, 0);
            light2.SpotInnerConeRadians = MathHelper.ToRadians(30.0f);
            light2.SpotOuterConeRadians = MathHelper.ToRadians(100.0f);

            // Initialize material settings for the floor.
            material.Ambient   = new Color(new Vector4(0.6f, 0.6f, 0.6f, 1.0f));
            material.Diffuse   = new Color(new Vector4(0.7f, 0.7f, 0.7f, 1.0f));
            material.Emissive  = Color.Black;
            material.Specular  = Color.White;
            material.Shininess = 0.0f;

            // Parallax mapping height scale and bias values.
            scaleBias = new Vector2(0.04f, -0.03f);
            //player = new Player();
            reddit = new System.Drawing.Bitmap(@"C:\gamephotos\awesomeface.jpg");
            InitCamera();

            world = new World(this, 10);
            this.Components.Add(world);

            color = Color.OrangeRed;

            interp = new SandvoxInterpreter(this, Content.Load <SpriteFont>("ConsoleFont"));
            interp.AddGlobal("game", this);

            brush = new InstanceBrush("brush.txt");
            //Face.InitializeFaces();
            base.Initialize();
        }