public override void Draw(DrawContext context, PxRect pxrect, PxRect? pxsampleRect = null, DrawColor? color = null) { context.Set(); Rectangle rect = pxrect.Rectangle(); Rectangle sampleRect; if (pxsampleRect == null) sampleRect = texture.Bounds; else sampleRect = pxsampleRect.Value.Rectangle(); // top left DrawBatch.Draw(texture, rect.MarginTop(fh).MarginLeft(fw).PxRect(), sampleRect.MarginTop(fh).MarginLeft(fw).PxRect(), color); // top DrawBatch.Draw(texture, rect.MarginTop(fh).Inflated(-fw, 0).PxRect(), sampleRect.MarginTop(fh).Inflated(-fw, 0).PxRect(), color); // top right DrawBatch.Draw(texture, rect.MarginTop(fh).MarginRight(fw).PxRect(), sampleRect.MarginTop(fh).MarginRight(fw).PxRect(), color); // left DrawBatch.Draw(texture, rect.Inflated(0, -fh).MarginLeft(fw).PxRect(), sampleRect.Inflated(0, -fh).MarginLeft(fw).PxRect(), color); // center DrawBatch.Draw(texture, rect.Inflated(-fw, -fh).PxRect(), sampleRect.Inflated(-fw, -fh).PxRect(), color); // right DrawBatch.Draw(texture, rect.Inflated(0, -fh).MarginRight(fw).PxRect(), sampleRect.Inflated(0, -fh).MarginRight(fw).PxRect(), color); // bottom left DrawBatch.Draw(texture, rect.MarginBottom(fh).MarginLeft(fw).PxRect(), sampleRect.MarginBottom(fh).MarginLeft(fw).PxRect(), color); // bottom DrawBatch.Draw(texture, rect.MarginBottom(fh).Inflated(-fw, 0).PxRect(), sampleRect.MarginBottom(fh).Inflated(-fw, 0).PxRect(), color); // bottom right DrawBatch.Draw(texture, rect.MarginBottom(fh).MarginRight(fw).PxRect(), sampleRect.MarginBottom(fh).MarginRight(fw).PxRect(), color); }
public override void Draw(DrawContext context, PxRect rect, PxRect? sampleRect = null, DrawColor? color = null) { if (dirty) { BuildTexture(); dirty = false; } context.Set(); int hoff = 0; int voff = (rect.H / 2) - (texture.Bounds.Height / 2); if (align == TextAlign.Right) hoff = rect.W - texture.Bounds.Width; else if (align == TextAlign.Center) hoff = (rect.W / 2) - (texture.Bounds.Width / 2); DrawBatch.Draw(texture, new PxRect(rect.Position + new PxVector(hoff, voff), texture.Bounds.Size.PxVector()), sampleRect, color); //DrawBatch.Draw(texture, rect, sampleRect, color); }
public override void Draw(DrawContext context, PxRect rect, PxRect? sampleRect = null, DrawColor? color = null) { }
public void Draw(DrawContext context, FxVector position, FxVector? align, PxRect? sampleRect, DrawColor? color, float rotation, float scale) { Draw(context, position, align, sampleRect, color, rotation, new FxVector(scale, scale)); }
public abstract void Draw(DrawContext context, FxVector position, FxVector? align = null, PxRect? sampleRect = null, DrawColor? color = null, float rotation = 0, FxVector? scale = null);
public abstract void Draw(DrawContext context, PxRect rect, PxRect? sampleRect = null, DrawColor? color = null);
public override void Draw(DrawContext context, PxRect rect, PxRect? sampleRect = null, DrawColor? color = null) { foreach (Drawable d in list) d.Draw(context, rect, sampleRect, color); }
public override void Draw(DrawContext context, FxVector position, FxVector? align = null, PxRect? sampleRect = null, DrawColor? color = null, float rotation = 0, FxVector? scale = null) { context.Set(); DrawBatch.Draw(texture, position, align, sampleRect, color, rotation, scale); }
public override void Draw(DrawContext context, PxRect rect, PxRect? sampleRect = null, DrawColor? color = null) { throw new NotImplementedException(); }
public static void Draw(Texture2D texture, FxVector position, FxVector? align, PxRect? sampleRect, DrawColor? color, float rotation, FxVector? scale) { Vector2 origin = new Vector2(texture.Width, texture.Height) * align.GetValueOrDefault(new FxVector(0.5f, 0.5f)).Vector2(); sb.Draw(texture, (position + drawOffset).Vector2(), (sampleRect == null) ? null : (Rectangle?)sampleRect.Value.Rectangle(), (color == null) ? Color.White : color.Value.Color(), rotation, origin, scale.GetValueOrDefault(new FxVector(1, 1)).Vector2(), SpriteEffects.None, 0); }
public static void Draw(Texture2D texture, PxRect rect, PxRect? sampleRect, DrawColor? color) { sb.Draw(texture, (rect + drawOffset).Rectangle(), (sampleRect == null) ? null : (Rectangle?)sampleRect.Value.Rectangle(), (color == null) ? Color.White : color.Value.Color()); }
public static void Clear(RenderTarget2D tgt, DrawColor color) { Clear(tgt, color.Color()); }
public override void Draw(DrawContext context, FxVector position, FxVector? align = null, PxRect? sampleRect = null, DrawColor? color = null, float rotation = 0, FxVector? scale = null) { throw new NotImplementedException(); }
public override void Draw(DrawContext context, PxRect rect, PxRect? sampleRect = null, DrawColor? color = null) { inner.Draw(context, rect, sampleRect, color); }
public override void Draw(DrawContext context, PxRect rect, PxRect? sampleRect = null, DrawColor? color = null) { context.Set(); DrawBatch.Draw(texture, rect, sampleRect, color); }
public override void Draw(DrawContext context, FxVector position, FxVector? align = null, PxRect? sampleRect = null, DrawColor? color = null, float rotation = 0, FxVector? scale = null) { inner.Draw(context, position, align, sampleRect, color, rotation, scale); }
public override void Clear(DrawColor color) { DrawBatch.Clear(target, color.Color()); }