public static CircleOfTransparency Create(int radius)
        {
            if (Circle == null)
            {
                Circle = new CircleOfTransparency(radius);
            }
            else
            {
                Circle._texture.Dispose();
                Circle._texture = null;
            }

            uint[] pixels = CreateTexture(radius, ref Circle._width, ref Circle._height);

            for (int i = 0; i < pixels.Length; i++)
            {
                ref uint pixel = ref pixels[i];

                if (pixel != 0)
                {
                    pixel = Color.Black.PackedValue;
                    //ushort value = (ushort)(pixel << 3);

                    //if (value > 0xFF)
                    //    value = 0xFF;

                    //pixel = (uint)((value << 24) | (value << 16) | (value << 8) | value);
                }
            }
Exemple #2
0
        public static CircleOfTransparency Create(int radius)
        {
            if (_circle == null)
            {
                _circle = new CircleOfTransparency(radius);
            }
            else
            {
                _circle._texture.Dispose();
                _circle._texture = null;
            }

            uint[] pixels = _circle.CreateTexture(radius, ref _circle._width, ref _circle._height);

            _circle.Radius = radius;

            _circle._texture = new Texture2D(Engine.Batcher.GraphicsDevice, _circle._width, _circle.Height, false, SurfaceFormat.Color);
            _circle._texture.SetData(pixels);

            return(_circle);
        }
Exemple #3
0
        public GameCursor()
        {
            short ww = 0;
            short hh = 0;

            uint[] data = CircleOfTransparency.CreateCircleTexture(25, ref ww, ref hh);

            for (int i = 0; i < data.Length; i++)
            {
                ref uint pixel = ref data[i];

                if (pixel != 0)
                {
                    ushort value = (ushort)(pixel << 3);

                    if (value > 0xFF)
                    {
                        value = 0xFF;
                    }

                    pixel = (uint)((value << 24) | (value << 16) | (value << 8) | value);
                }
            }
        public static CircleOfTransparency Create(int radius)
        {
            if (Circle == null)
            {
                Circle = new CircleOfTransparency(radius);
            }
            else
            {
                Circle._texture.Dispose();
                Circle._texture = null;
            }

            uint[] pixels = CreateTexture(radius, ref Circle._width, ref Circle._height);

            //for (int i = 0; i < pixels.Length; i++)
            //{
            //    ref uint pixel = ref pixels[i];

            //    if (pixel != 0)
            //    {
            //        ushort value = (ushort)(pixel << 3);

            //        if (value > 0xFF)
            //            value = 0xFF;

            //        pixel = (uint)((value << 24) | (value << 16) | (value << 8) | value);
            //    }
            //}


            Circle.Radius = radius;

            Circle._texture = new Texture2D(Engine.Batcher.GraphicsDevice, Circle._width, Circle.Height);
            Circle._texture.SetData(pixels);

            return(Circle);
        }