Пример #1
0
        /// <summary>
        /// Required method for Designer support - do not modify
        /// the contents of this method with the code editor.
        /// </summary>
        private void InitializeComponent()
        {
            XNAParalax.ParalaxBackground paralaxBackground1          = new XNAParalax.ParalaxBackground();
            System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(BasicParallaxScrollDemo));
            this.graphics           = new Microsoft.Xna.Framework.Components.GraphicsComponent();
            this.paralaxBackground  = new XNAParalax.ParalaxBackgroundComponent();
            this.scrollingCamera2d1 = new XNAParalax.ScrollingCamera2d();
            //
            // graphics
            //
            this.graphics.AllowMultiSampling         = false;
            this.graphics.MinimumPixelShaderProfile  = Microsoft.Xna.Framework.Graphics.ShaderProfile.PS_1_1;
            this.graphics.MinimumVertexShaderProfile = Microsoft.Xna.Framework.Graphics.ShaderProfile.VS_1_1;
            this.graphics.DepthStencilFormat         = Microsoft.Xna.Framework.Graphics.DepthFormat.Depth16;

            //
            // paralaxBackground
            //
            paralaxBackground1.FileName = "Media\\city.jpg";
            paralaxBackground1.TileX    = true;
            paralaxBackground1.TileY    = false;
            this.paralaxBackground.Backgrounds.Add(paralaxBackground1);
            this.paralaxBackground.Camera = this.scrollingCamera2d1;
            //
            // scrollingCamera2d1
            //
            this.scrollingCamera2d1.Speed    = ((Microsoft.Xna.Framework.Vector2)(resources.GetObject("scrollingCamera2d1.Speed")));
            this.scrollingCamera2d1.WorldPos = ((Microsoft.Xna.Framework.Vector2)(resources.GetObject("scrollingCamera2d1.WorldPos")));
            this.GameComponents.Add(this.graphics);
            this.GameComponents.Add(this.paralaxBackground);
            this.GameComponents.Add(this.scrollingCamera2d1);
        }
Пример #2
0
 /// <summary>
 /// Required method for Designer support - do not modify
 /// the contents of this method with the code editor.
 /// </summary>
 private void InitializeComponent()
 {
     XNAParalax.ParalaxBackground paralaxBackground1 = ((XNAParalax.ParalaxBackground)(new XNAParalax.ParalaxBackground()));
     XNAParalax.ParalaxBackground paralaxBackground2 = ((XNAParalax.ParalaxBackground)(new XNAParalax.ParalaxBackground()));
     this.scroller1 = ((XNAParalax.XNAScroller.Scroller)(new XNAParalax.XNAScroller.Scroller()));
     this.scroller2 = ((XNAParalax.XNAScroller.Scroller)(new XNAParalax.XNAScroller.Scroller()));
     this.graphics  = new Microsoft.Xna.Framework.Components.GraphicsComponent();
     this.camera2d1 = new XNAParalax.Camera2d();
     this.paralaxBackgroundComponent1 = new XNAParalax.ParalaxBackgroundComponent();
     //
     // scroller1
     //
     this.scroller1.Offset = 0F;
     this.scroller1.Speed  = 20F;
     //
     // scroller2
     //
     this.scroller2.Offset = 0F;
     this.scroller2.Speed  = 10F;
     //
     // graphics
     //
     this.graphics.AllowMultiSampling = false;
     //
     // camera2d1
     //
     this.camera2d1.WorldPos = new Microsoft.Xna.Framework.Vector2(0F, 0F);
     //
     // paralaxBackgroundComponent1
     //
     paralaxBackground1.FileName           = "Media\\cloud.dds";
     paralaxBackground1.LayerDepth         = 0.1F;
     paralaxBackground1.Offset             = new Microsoft.Xna.Framework.Vector2(150F, 100F);
     paralaxBackground1.TileX              = true;
     paralaxBackground1.TileY              = false;
     paralaxBackground1.XScrollerComponent = this.scroller1;
     paralaxBackground2.FileName           = "Media\\cloud.dds";
     paralaxBackground2.LayerDepth         = 0.5F;
     paralaxBackground2.Offset             = new Microsoft.Xna.Framework.Vector2(0F, 0F);
     paralaxBackground2.TileX              = true;
     paralaxBackground2.TileY              = false;
     paralaxBackground2.XScrollerComponent = this.scroller2;
     this.paralaxBackgroundComponent1.Backgrounds.Add(paralaxBackground1);
     this.paralaxBackgroundComponent1.Backgrounds.Add(paralaxBackground2);
     this.paralaxBackgroundComponent1.Camera = this.camera2d1;
     this.GameComponents.Add(this.graphics);
     this.GameComponents.Add(this.camera2d1);
     this.GameComponents.Add(this.paralaxBackgroundComponent1);
     this.GameComponents.Add(this.scroller1);
     this.GameComponents.Add(this.scroller2);
 }