protected override void Initialize()
        {
            // Screen Init
            graphics.IsFullScreen              = false;
            graphics.PreferredBackBufferWidth  = width;
            graphics.PreferredBackBufferHeight = height;
            graphics.ApplyChanges();
            Window.Title = "Example 2.5: Fluid Resistance";

            this.IsMouseVisible = true;

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

            Helpers.Drawing.init(device, spriteBatch);

            movers = new Mover[20];
            int step = (width - 50) / movers.Length;

            for (int i = 0; i < movers.Length; i++)
            {
                movers[i] = new Mover(rnd.Next(1, 5), 50 + step * i, 100f, width, height);
            }

            liquid = new Liquid(0f, height / 2, width, height / 2, 0.1f);

            base.Initialize();
        }
 public Boolean isInside(Liquid l)
 {
     if (location.X > l.x && location.X < l.x + l.w && location.Y > l.y && location.Y < l.y + l.h)
     {
         return(true);
     }
     else
     {
         return(false);
     }
 }
        public void drag(Liquid l)
        {
            float speed         = velocity.Length();
            float dragMagnitude = l.c * speed * speed;

            Vector2 drag = new Vector2(velocity.X, velocity.Y);

            drag = Vector2.Multiply(drag, -1f);
            drag.Normalize();

            drag = Vector2.Multiply(drag, dragMagnitude);

            applyForce(drag);
        }
        protected override void Initialize()
        {
            // Screen Init
            graphics.IsFullScreen = false;
            graphics.PreferredBackBufferWidth = width;
            graphics.PreferredBackBufferHeight = height;
            graphics.ApplyChanges();
            Window.Title = "Example 2.5: Fluid Resistance";

            this.IsMouseVisible = true;

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

            Helpers.Drawing.init(device, spriteBatch);

            movers = new Mover[20];
            int step = (width - 50) / movers.Length;

            for (int i = 0; i < movers.Length; i++)
            {
                movers[i] = new Mover(rnd.Next(1, 5), 50 + step*i, 100f, width, height);
            }

            liquid = new Liquid(0f, height / 2, width, height / 2, 0.1f);

            base.Initialize();
        }
        public void drag(Liquid l)
        {
            float speed = velocity.Length();
            float dragMagnitude = l.c * speed * speed;

            Vector2 drag = new Vector2(velocity.X, velocity.Y);
            drag = Vector2.Multiply(drag, -1f);
            drag.Normalize();

            drag = Vector2.Multiply(drag, dragMagnitude);

            applyForce(drag);
        }
 public Boolean isInside(Liquid l)
 {
     if (location.X > l.x && location.X < l.x + l.w && location.Y > l.y && location.Y < l.y + l.h)
     {
         return true;
     }
     else
     {
         return false;
     }
 }