Esempio n. 1
0
        static public void UseDebugPixelTexture()
        {
            Texture texture = new Texture(2, 2, Color.White);

            Pixel    = new Subtexture(texture, 0, 0, 1, 1);
            Particle = new Subtexture(texture, 0, 0, 2, 2);
        }
Esempio n. 2
0
 public Subtexture(Subtexture sub, int x, int y, int width, int height)
 {
     Texture     = sub.Texture;
     Rect        = sub.Rect;
     Rect.X     += x;
     Rect.Y     += y;
     Rect.Width  = width;
     Rect.Height = height;
 }
Esempio n. 3
0
 public Subtexture(Subtexture sub, int x, int y, int width, int height)
 {
     Texture = sub.Texture;
     Rect = sub.Rect;
     Rect.X += x;
     Rect.Y += y;
     Rect.Width = width;
     Rect.Height = height;
 }
Esempio n. 4
0
        internal Image(Subtexture subTexture, Rectangle? clipRect, bool active)
            : base(active)
        {
            Texture = subTexture.Texture;

            if (clipRect.HasValue)
                ClipRect = subTexture.GetAbsoluteClipRect(clipRect.Value);
            else
                ClipRect = subTexture.Rect;
        }
Esempio n. 5
0
        static public void TextureJustify(Subtexture subtexture, Rectangle clipRect, Vector2 position, Color color, Vector2 justify)
        {
            Rectangle drawRect = subtexture.Rect;

            drawRect.X     += clipRect.X;
            drawRect.Y     += clipRect.Y;
            drawRect.Width  = clipRect.Width;
            drawRect.Height = clipRect.Height;

            Vector2 origin = new Vector2(drawRect.Width * justify.X, drawRect.Height * justify.Y);

            SpriteBatch.Draw(subtexture.Texture.Texture2D, Calc.Floor(position), drawRect, color, 0, origin, Vector2.One, SpriteEffects.None, 0);
        }
Esempio n. 6
0
        public TiledImage(Subtexture source, Rectangle? clipRect, int width, int height, int offsetX = 0, int offsetY = 0)
            : base(false)
        {
            this.source = source;

            if (clipRect.HasValue)
                this.clipRect = source.GetAbsoluteClipRect(clipRect.Value);
            else
                this.clipRect = source.Rect;

            canvas = new Canvas(width, height);
            SetOffsets(offsetX, offsetY);
        }
Esempio n. 7
0
        public new void SwapSubtexture(Subtexture setTo, Rectangle?clipRect = null)
        {
            Rectangle old = ClipRect;

            Texture  = setTo.Texture;
            ClipRect = clipRect ?? setTo.Rect;

            for (int i = 0; i < FrameRects.Length; i++)
            {
                FrameRects[i].X += ClipRect.X - old.X;
                FrameRects[i].Y += ClipRect.Y - old.Y;
            }
        }
Esempio n. 8
0
        internal Image(Subtexture subTexture, Rectangle?clipRect, bool active)
            : base(active)
        {
            Texture = subTexture.Texture;

            if (clipRect.HasValue)
            {
                ClipRect = subTexture.GetAbsoluteClipRect(clipRect.Value);
            }
            else
            {
                ClipRect = subTexture.Rect;
            }
        }
Esempio n. 9
0
        static public void OutlineTextureCentered(Subtexture subTexture, Vector2 position, Color color, Vector2 scale)
        {
            for (int i = -1; i <= 1; i++)
            {
                for (int j = -1; j <= 1; j++)
                {
                    if (i != 0 || j != 0)
                    {
                        SpriteBatch.Draw(subTexture.Texture.Texture2D, Calc.Floor(position) + new Vector2(i, j), subTexture.Rect, Color.Black, 0, new Vector2(subTexture.Rect.Width / 2, subTexture.Rect.Height / 2), scale, SpriteEffects.None, 0);
                    }
                }
            }

            SpriteBatch.Draw(subTexture.Texture.Texture2D, Calc.Floor(position), subTexture.Rect, color, 0, new Vector2(subTexture.Rect.Width / 2, subTexture.Rect.Height / 2), scale, SpriteEffects.None, 0);
        }
Esempio n. 10
0
        public TiledImage(Subtexture source, Rectangle?clipRect, int width, int height, int offsetX = 0, int offsetY = 0)
            : base(false)
        {
            this.source = source;

            if (clipRect.HasValue)
            {
                this.clipRect = source.GetAbsoluteClipRect(clipRect.Value);
            }
            else
            {
                this.clipRect = source.Rect;
            }

            canvas = new Canvas(width, height);
            SetOffsets(offsetX, offsetY);
        }
Esempio n. 11
0
 public ParticleType(ParticleType copy)
 {
     Source = copy.Source;
     Color = copy.Color;
     Color2 = copy.Color2;
     ColorSwitch = copy.ColorSwitch;
     ColorSwitchLoop = copy.ColorSwitchLoop;
     Speed = copy.Speed;
     SpeedRange = copy.SpeedRange;
     SpeedMultiplier = copy.SpeedMultiplier;
     Acceleration = copy.Acceleration;
     Direction = copy.Direction;
     DirectionRange = copy.DirectionRange;
     Life = copy.Life;
     LifeRange = copy.LifeRange;
     Size = copy.Size;
     SizeRange = copy.SizeRange;
 }
Esempio n. 12
0
        public ParticleType(ParticleType copy)
        {
            Source          = copy.Source;
            Color           = copy.Color;
            Color2          = copy.Color2;
            ColorSwitch     = copy.ColorSwitch;
            ColorSwitchLoop = copy.ColorSwitchLoop;
            Speed           = copy.Speed;
            SpeedRange      = copy.SpeedRange;
            SpeedMultiplier = copy.SpeedMultiplier;
            Acceleration    = copy.Acceleration;
            Direction       = copy.Direction;
            DirectionRange  = copy.DirectionRange;
            Life            = copy.Life;
            LifeRange       = copy.LifeRange;
            Size            = copy.Size;
            SizeRange       = copy.SizeRange;
            Rotated         = copy.Rotated;
            RandomRotate    = copy.RandomRotate;
            ScaleOut        = copy.ScaleOut;

            AllTypes.Add(this);
        }
Esempio n. 13
0
        public ParticleType(ParticleType copy)
        {
            Source = copy.Source;
            Color = copy.Color;
            Color2 = copy.Color2;
            ColorSwitch = copy.ColorSwitch;
            ColorSwitchLoop = copy.ColorSwitchLoop;
            Speed = copy.Speed;
            SpeedRange = copy.SpeedRange;
            SpeedMultiplier = copy.SpeedMultiplier;
            Acceleration = copy.Acceleration;
            Direction = copy.Direction;
            DirectionRange = copy.DirectionRange;
            Life = copy.Life;
            LifeRange = copy.LifeRange;
            Size = copy.Size;
            SizeRange = copy.SizeRange;
            Rotated = copy.Rotated;
            RandomRotate = copy.RandomRotate;
            ScaleOut = copy.ScaleOut;

            AllTypes.Add(this);
        }
Esempio n. 14
0
 public void AddFrame(Subtexture subtexture)
 {
     AddFrame(new SpriteFrame(subtexture));
 }
Esempio n. 15
0
 public static void Texture(Subtexture subTexture, Vector2 position, Color color)
 {
     SpriteBatch.Draw(subTexture.Texture.Texture2D, Calc.Floor(position), subTexture.Rect, color);
 }
 public MotionBlurImage(Subtexture subtexture, int blurs)
     : base(subtexture)
 {
     blurData = new MotionBlurData[blurs];
 }
Esempio n. 17
0
 /// <summary>
 /// Create a SpriteFrame with a centered origin point
 /// </summary>
 /// <param name="subtexture"></param>
 public SpriteFrame(Subtexture subtexture)
 {
     Subtexture = subtexture;
     Origin     = subtexture.Center;
 }
Esempio n. 18
0
 public static void UseDebugPixelTexture()
 {
     Texture texture = new Texture(2, 2, Color.White);
     Pixel = new Subtexture(texture, 0, 0, 1, 1);
     Particle = new Subtexture(texture, 0, 0, 2, 2);
 }
Esempio n. 19
0
 public Spritesheet(Subtexture subTexture, int frameWidth, int frameHeight, int frameSep = 0)
     : this(subTexture, null, frameWidth, frameHeight, frameSep)
 {
 }
Esempio n. 20
0
 static public void TextureCentered(Subtexture subTexture, Rectangle clipRect, Vector2 position, Color color, float scale, float rotation)
 {
     SpriteBatch.Draw(subTexture.Texture.Texture2D, Calc.Floor(position), subTexture.GetAbsoluteClipRect(clipRect), color, rotation, new Vector2(clipRect.Width / 2, clipRect.Height / 2), scale, SpriteEffects.None, 0);
 }
Esempio n. 21
0
 static public void Texture(Subtexture subTexture, Vector2 position, Color color, Vector2 origin, Vector2 scale)
 {
     SpriteBatch.Draw(subTexture.Texture.Texture2D, Calc.Floor(position), subTexture.Rect, color, 0, origin, scale, SpriteEffects.None, 0);
 }
Esempio n. 22
0
 public TilableBackground(string image, int layerIndex)
     : base(layerIndex)
 {
     texture = OldSkullGame.Atlas[image];
 }
Esempio n. 23
0
 static public void TextureCentered(Subtexture subTexture, Vector2 position, Color color, Vector2 scale, float rotation)
 {
     SpriteBatch.Draw(subTexture.Texture.Texture2D, Calc.Floor(position), subTexture.Rect, color, rotation, new Vector2(subTexture.Rect.Width / 2, subTexture.Rect.Height / 2), scale, SpriteEffects.None, 0);
 }
Esempio n. 24
0
 static public void TextureCentered(Subtexture subTexture, Vector2 position)
 {
     SpriteBatch.Draw(subTexture.Texture.Texture2D, Calc.Floor(position), subTexture.Rect, Color.White, 0, new Vector2(subTexture.Rect.Width / 2, subTexture.Rect.Height / 2), 1, SpriteEffects.None, 0);
 }
Esempio n. 25
0
 static public void Texture(Subtexture subTexture, Rectangle clipRect, Vector2 position, Color color)
 {
     SpriteBatch.Draw(subTexture.Texture.Texture2D, Calc.Floor(position), subTexture.GetAbsoluteClipRect(clipRect), color);
 }
Esempio n. 26
0
 static public void Texture(Subtexture subTexture, Vector2 position, Color color, Vector2 origin, float scale, float rotation, SpriteEffects effects)
 {
     SpriteBatch.Draw(subTexture.Texture.Texture2D, Calc.Floor(position), subTexture.Rect, color, rotation, origin, scale, effects, 0);
 }
Esempio n. 27
0
 public static void Texture(Subtexture subTexture, Vector2 position, Color color, Vector2 origin, float scale, float rotation, SpriteEffects effects)
 {
     SpriteBatch.Draw(subTexture.Texture.Texture2D, Calc.Floor(position), subTexture.Rect, color, rotation, origin, scale, effects, 0);
 }
Esempio n. 28
0
 static public void TextureJustify(Subtexture subtexture, Vector2 position, Color color, Vector2 scale, float rotation, Vector2 justify)
 {
     SpriteBatch.Draw(subtexture.Texture.Texture2D, Calc.Floor(position), subtexture.Rect, color, rotation, subtexture.Size * justify, scale, SpriteEffects.None, 0);
 }
Esempio n. 29
0
 public static void TextureBannerV(Subtexture subtexture, Vector2 position, Vector2 origin, Vector2 scale, float rotation, Color color, SpriteEffects effects, float sineCounter, float amplitude = 2, int sliceSize = 2, float sliceAdd = MathHelper.TwoPi / 8)
 {
     TextureBannerV(subtexture.Texture, subtexture.Rect, position, origin, scale, rotation, color, effects, sineCounter, amplitude, sliceSize, sliceAdd);
 }
Esempio n. 30
0
 public void SetTileset(Subtexture tileset, int tileWidth, int tileHeight, int tileSep = 0)
 {
     SetTileset(tileset.Texture, tileset.Rect, tileWidth, tileHeight, tileSep);
 }
Esempio n. 31
0
 public static void TextureJustify(Subtexture subtexture, Vector2 position, Color color, Vector2 scale, float rotation, Vector2 justify)
 {
     SpriteBatch.Draw(subtexture.Texture.Texture2D, Calc.Floor(position), subtexture.Rect, color, rotation, subtexture.Size * justify, scale, SpriteEffects.None, 0);
 }
Esempio n. 32
0
 static public void SineTextureH(Subtexture subtexture, Vector2 position, Vector2 origin, Vector2 scale, float rotation, Color color, SpriteEffects effects, float sineCounter, float amplitude = 2, int sliceSize = 2, float sliceAdd = MathHelper.TwoPi / 8)
 {
     SineTextureH(subtexture.Texture, subtexture.Rect, position, origin, scale, rotation, color, effects, sineCounter, amplitude, sliceSize, sliceAdd);
 }
Esempio n. 33
0
 public Image(Subtexture subTexture, Rectangle? clipRect = null)
     : this(subTexture, clipRect, false)
 {
 }
Esempio n. 34
0
 public FlashingImage(Subtexture subTexture, Rectangle? clipRect = null)
     : base(subTexture, clipRect, true)
 {
 }
Esempio n. 35
0
 public FlashingImage(Subtexture subTexture, Rectangle?clipRect = null)
     : base(subTexture, clipRect, true)
 {
 }
Esempio n. 36
0
 static public void TextureFill(Subtexture subTexture, Rectangle fillArea, int offsetX, int offsetY)
 {
     TextureFill(subTexture.Texture, subTexture.Rect, fillArea, offsetX, offsetY);
 }
Esempio n. 37
0
 /// <summary>
 /// Create a SpriteFrame with a defined origin point
 /// </summary>
 /// <param name="subtexture"></param>
 /// <param name="origin"></param>
 public SpriteFrame(Subtexture subtexture, Vector2 origin)
 {
     Subtexture = subtexture;
     Origin     = origin;
 }
Esempio n. 38
0
 static public void TextureFill(Subtexture subTexture, Rectangle fillArea)
 {
     TextureFill(subTexture.Texture, subTexture.Rect, fillArea);
 }
Esempio n. 39
0
 public void AddFrame(Subtexture subtexture, Vector2 origin)
 {
     AddFrame(new SpriteFrame(subtexture, origin));
 }
Esempio n. 40
0
 public OutlineImage(Subtexture subtexture)
     : base(subtexture)
 {
     OutlineColor = Color.Black;
 }
Esempio n. 41
0
        public static void OutlineTextureCentered(Subtexture subTexture, Vector2 position, Color color, Vector2 scale)
        {
            for (int i = -1; i <= 1; i++)
                for (int j = -1; j <= 1; j++)
                    if (i != 0 || j != 0)
                        SpriteBatch.Draw(subTexture.Texture.Texture2D, Calc.Floor(position) + new Vector2(i, j), subTexture.Rect, Color.Black, 0, new Vector2(subTexture.Rect.Width / 2, subTexture.Rect.Height / 2), scale, SpriteEffects.None, 0);

            SpriteBatch.Draw(subTexture.Texture.Texture2D, Calc.Floor(position), subTexture.Rect, color, 0, new Vector2(subTexture.Rect.Width / 2, subTexture.Rect.Height / 2), scale, SpriteEffects.None, 0);
        }
Esempio n. 42
0
 public TiledImage(Subtexture source, int width, int height, int offsetX = 0, int offsetY = 0)
     : this(source, null, width, height, offsetX, offsetY)
 {
 }
Esempio n. 43
0
 public static void Texture(Subtexture subTexture, Vector2 position, Color color, Vector2 origin, Vector2 scale)
 {
     SpriteBatch.Draw(subTexture.Texture.Texture2D, Calc.Floor(position), subTexture.Rect, color, 0, origin, scale, SpriteEffects.None, 0);
 }
Esempio n. 44
0
 public static void TextureCentered(Subtexture subTexture, Vector2 position, Color color, Vector2 scale, float rotation)
 {
     SpriteBatch.Draw(subTexture.Texture.Texture2D, Calc.Floor(position), subTexture.Rect, color, rotation, new Vector2(subTexture.Rect.Width / 2, subTexture.Rect.Height / 2), scale, SpriteEffects.None, 0);
 }
Esempio n. 45
0
 public static void Texture(Subtexture subTexture, Rectangle clipRect, Vector2 position, Color color)
 {
     SpriteBatch.Draw(subTexture.Texture.Texture2D, Calc.Floor(position), subTexture.GetAbsoluteClipRect(clipRect), color);
 }
Esempio n. 46
0
 public static void TextureFill(Subtexture subTexture, Rectangle fillArea, int offsetX, int offsetY)
 {
     TextureFill(subTexture.Texture, subTexture.Rect, fillArea, offsetX, offsetY);
 }
Esempio n. 47
0
 public static void TextureCentered(Subtexture subTexture, Vector2 position)
 {
     SpriteBatch.Draw(subTexture.Texture.Texture2D, Calc.Floor(position), subTexture.Rect, Color.White, 0, new Vector2(subTexture.Rect.Width / 2, subTexture.Rect.Height / 2), 1, SpriteEffects.None, 0);
 }
Esempio n. 48
0
 static public void Texture(Subtexture subTexture, Vector2 position, Color color)
 {
     SpriteBatch.Draw(subTexture.Texture.Texture2D, Calc.Floor(position), subTexture.Rect, color);
 }
Esempio n. 49
0
 public static void TextureCentered(Subtexture subTexture, Rectangle clipRect, Vector2 position, Color color, float scale, float rotation)
 {
     SpriteBatch.Draw(subTexture.Texture.Texture2D, Calc.Floor(position), subTexture.GetAbsoluteClipRect(clipRect), color, rotation, new Vector2(clipRect.Width / 2, clipRect.Height / 2), scale, SpriteEffects.None, 0);
 }
Esempio n. 50
0
 public Tileset(int layerIndex,string csv,Subtexture texture)
     : base(layerIndex)
 {
     this.csv = csv;
     this.texture = texture;
 }
Esempio n. 51
0
 public static void TextureFill(Subtexture subTexture, Rectangle fillArea)
 {
     TextureFill(subTexture.Texture, subTexture.Rect, fillArea);
 }
Esempio n. 52
0
 public void SwapSubtexture(Subtexture subtexture, Rectangle?clipRect = null)
 {
     Texture  = subtexture.Texture;
     ClipRect = clipRect ?? subtexture.Rect;
 }
Esempio n. 53
0
        public static void TextureJustify(Subtexture subtexture, Rectangle clipRect, Vector2 position, Color color, Vector2 justify)
        {
            Rectangle drawRect = subtexture.Rect;
            drawRect.X += clipRect.X;
            drawRect.Y += clipRect.Y;
            drawRect.Width = clipRect.Width;
            drawRect.Height = clipRect.Height;

            Vector2 origin = new Vector2(drawRect.Width * justify.X, drawRect.Height * justify.Y);

            SpriteBatch.Draw(subtexture.Texture.Texture2D, Calc.Floor(position), drawRect, color, 0, origin, Vector2.One, SpriteEffects.None, 0);
        }
 public MotionBlurImage(Subtexture subtexture, int blurs)
     : base(subtexture)
 {
     blurData = new MotionBlurData[blurs];
 }
Esempio n. 55
0
 public void SwapSubtexture(Subtexture subtexture, Rectangle? clipRect = null)
 {
     Texture = subtexture.Texture;
     ClipRect = clipRect ?? subtexture.Rect;
 }
Esempio n. 56
0
 public MotionBlurSpritesheet(Subtexture subtexture, int frameWidth, int frameHeight, int blurs)
     : base(subtexture, frameWidth, frameHeight)
 {
     blurData = new MotionBlurData[blurs];
 }
Esempio n. 57
0
 public Image(Subtexture subTexture, Rectangle?clipRect = null)
     : this(subTexture, clipRect, false)
 {
 }
Esempio n. 58
0
 public Spritesheet(Subtexture subTexture, Rectangle?clipRect, int frameWidth, int frameHeight, int frameSep = 0)
     : base(subTexture, clipRect, true)
 {
     Initialize(frameWidth, frameHeight, frameSep);
 }