public LightningTexture(GraphicsDevice device, int width, int height)
            : base(device, width, height)
        {
            anim = new AnimatedLightning(Vector2.Zero, new Vector2(width, height), 45, MathHelper.ToRadians(45), 0.7f, 5, 1, 10);

            var sb = new SpriteBatch(device);
            var target = new RenderTarget2D(GraphicsDevice, 50, 100, false
                , GraphicsDevice.PresentationParameters.BackBufferFormat
                , GraphicsDevice.PresentationParameters.DepthStencilFormat);
            var oldTargets = GraphicsDevice.GetRenderTargets();
            GraphicsDevice.SetRenderTarget(target);
            sb.Begin();
            foreach (var segment in anim.Segments)
            {
                sb.DrawLine(segment.From, segment.To, segment.Color);
            }
            sb.End();
            GraphicsDevice.SetRenderTargets(oldTargets);
            Color[] data = new Color[target.Width * target.Height];
            target.GetData<Color>(data);
            this.SetData<Color>(data);
        }
        /// <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()
        {
            graphics.IsFullScreen = false;
            graphics.PreferredBackBufferWidth = 512;
            graphics.PreferredBackBufferHeight = 512;
            graphics.ApplyChanges();

            SpriteBatchHelpers.Initialize(this.GraphicsDevice);
            inputSystem = new InputSystem(this);

            anim = new AnimatedLightning(Vector2.One * 12, Vector2.One * 500, 45, MathHelper.ToRadians(45), 0.7f, 5, 1, 10);

            //lightningPoints = LightningGenerator.Get(Vector2.One * 12, Vector2.One * 500, 140, 5, 1);
            //lightningSegments = LightningGenerator.GetForked(Vector2.One * 12, Vector2.One * 500, 45, MathHelper.ToRadians(45), 0.7f, 5, 1);

            inputSystem.RegisterKeyReleasedAction(Keys.Escape, () => Exit());
            inputSystem.RegisterMouseMoveAction((x, y) =>
                {
                    anim.End += new Vector2(x, y);
                });

            base.Initialize();
        }