Пример #1
0
        protected override void Initialize()
        {
            // Screen Init
            graphics.IsFullScreen              = false;
            graphics.PreferredBackBufferWidth  = width;
            graphics.PreferredBackBufferHeight = height;
            graphics.ApplyChanges();
            Window.Title        = "Exercise 2.8";
            this.IsMouseVisible = true;

            // Graphics Init
            spriteBatch = new SpriteBatch(GraphicsDevice);
            device      = graphics.GraphicsDevice;
            Helpers.Drawing.init(device, spriteBatch);
            device.Clear(Color.White);

            // RenderTarget Init
            rt = new RenderTarget2D(device, width, height, true, device.DisplayMode.Format, DepthFormat.Depth24, 1, RenderTargetUsage.PreserveContents);
            device.SetRenderTarget(rt);
            device.Clear(Color.Gray);
            device.SetRenderTarget(null);

            // Objects Init
            movers = new Mover[900];
            float step = (float)width / (float)movers.Length;

            for (int i = 0; i < movers.Length; i++)
            {
                movers[i] = new Mover(200, step * i, 0, width, height);
            }

            attractors    = new Attractor[1];
            attractors[0] = new Attractor(width, height);

            center = new Attractor
                     //
                     base.Initialize();
        }
Пример #2
0
        protected override void Initialize()
        {
            // Screen Init
            graphics.IsFullScreen = false;
            graphics.PreferredBackBufferWidth = width;
            graphics.PreferredBackBufferHeight = height;
            graphics.ApplyChanges();
            Window.Title = "Exercise 2.8";
            this.IsMouseVisible = true;

            // Graphics Init
            spriteBatch = new SpriteBatch(GraphicsDevice);
            device = graphics.GraphicsDevice;
            Helpers.Drawing.init(device, spriteBatch);
            device.Clear(Color.White);

            // RenderTarget Init
            rt = new RenderTarget2D(device, width, height, true, device.DisplayMode.Format, DepthFormat.Depth24, 1, RenderTargetUsage.PreserveContents);
            device.SetRenderTarget(rt);
            device.Clear(Color.Gray);
            device.SetRenderTarget(null);

            // Objects Init
            movers = new Mover[900];
            float step = (float)width/(float)movers.Length;

            for (int i = 0; i < movers.Length; i++)
            {
                movers[i] = new Mover(200, step * i, 0, width, height);
            }

            attractors = new Attractor[1];
            attractors[0] = new Attractor(width, height);

            center = new Attractor
            //
            base.Initialize();
        }