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); }
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; }
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; }
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); }
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); }
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; } }
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; } }
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); }
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); }
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; }
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); }
public void AddFrame(Subtexture subtexture) { AddFrame(new SpriteFrame(subtexture)); }
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]; }
/// <summary> /// Create a SpriteFrame with a centered origin point /// </summary> /// <param name="subtexture"></param> public SpriteFrame(Subtexture subtexture) { Subtexture = subtexture; Origin = subtexture.Center; }
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); }
public Spritesheet(Subtexture subTexture, int frameWidth, int frameHeight, int frameSep = 0) : this(subTexture, null, frameWidth, frameHeight, frameSep) { }
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); }
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); }
public TilableBackground(string image, int layerIndex) : base(layerIndex) { texture = OldSkullGame.Atlas[image]; }
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); }
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); }
static public void Texture(Subtexture subTexture, Rectangle clipRect, Vector2 position, Color color) { SpriteBatch.Draw(subTexture.Texture.Texture2D, Calc.Floor(position), subTexture.GetAbsoluteClipRect(clipRect), color); }
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); }
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); }
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); }
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); }
public void SetTileset(Subtexture tileset, int tileWidth, int tileHeight, int tileSep = 0) { SetTileset(tileset.Texture, tileset.Rect, tileWidth, tileHeight, tileSep); }
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); }
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); }
public Image(Subtexture subTexture, Rectangle? clipRect = null) : this(subTexture, clipRect, false) { }
public FlashingImage(Subtexture subTexture, Rectangle? clipRect = null) : base(subTexture, clipRect, true) { }
public FlashingImage(Subtexture subTexture, Rectangle?clipRect = null) : base(subTexture, clipRect, true) { }
static public void TextureFill(Subtexture subTexture, Rectangle fillArea, int offsetX, int offsetY) { TextureFill(subTexture.Texture, subTexture.Rect, fillArea, offsetX, offsetY); }
/// <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; }
static public void TextureFill(Subtexture subTexture, Rectangle fillArea) { TextureFill(subTexture.Texture, subTexture.Rect, fillArea); }
public void AddFrame(Subtexture subtexture, Vector2 origin) { AddFrame(new SpriteFrame(subtexture, origin)); }
public OutlineImage(Subtexture subtexture) : base(subtexture) { OutlineColor = Color.Black; }
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); }
public TiledImage(Subtexture source, int width, int height, int offsetX = 0, int offsetY = 0) : this(source, null, width, height, offsetX, offsetY) { }
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); }
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); }
public static void Texture(Subtexture subTexture, Rectangle clipRect, Vector2 position, Color color) { SpriteBatch.Draw(subTexture.Texture.Texture2D, Calc.Floor(position), subTexture.GetAbsoluteClipRect(clipRect), color); }
public static void TextureFill(Subtexture subTexture, Rectangle fillArea, int offsetX, int offsetY) { TextureFill(subTexture.Texture, subTexture.Rect, fillArea, offsetX, offsetY); }
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); }
static public void Texture(Subtexture subTexture, Vector2 position, Color color) { SpriteBatch.Draw(subTexture.Texture.Texture2D, Calc.Floor(position), subTexture.Rect, color); }
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); }
public Tileset(int layerIndex,string csv,Subtexture texture) : base(layerIndex) { this.csv = csv; this.texture = texture; }
public static void TextureFill(Subtexture subTexture, Rectangle fillArea) { TextureFill(subTexture.Texture, subTexture.Rect, fillArea); }
public void SwapSubtexture(Subtexture subtexture, Rectangle?clipRect = null) { Texture = subtexture.Texture; ClipRect = clipRect ?? subtexture.Rect; }
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 void SwapSubtexture(Subtexture subtexture, Rectangle? clipRect = null) { Texture = subtexture.Texture; ClipRect = clipRect ?? subtexture.Rect; }
public MotionBlurSpritesheet(Subtexture subtexture, int frameWidth, int frameHeight, int blurs) : base(subtexture, frameWidth, frameHeight) { blurData = new MotionBlurData[blurs]; }
public Image(Subtexture subTexture, Rectangle?clipRect = null) : this(subTexture, clipRect, false) { }
public Spritesheet(Subtexture subTexture, Rectangle?clipRect, int frameWidth, int frameHeight, int frameSep = 0) : base(subTexture, clipRect, true) { Initialize(frameWidth, frameHeight, frameSep); }