예제 #1
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);
        }
예제 #2
0
        public GameCursor()
        {
            short ww = 0;
            short hh = 0;

            uint[] data = CircleOfTransparency.CreateTexture(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);
                }
            }