Пример #1
0
        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);
        }
Пример #2
0
        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);
        }
Пример #3
0
 public override void Draw(DrawContext context, PxRect rect, PxRect? sampleRect = null, DrawColor? color = null)
 {
 }
Пример #4
0
 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));
 }
Пример #5
0
 public abstract void Draw(DrawContext context, FxVector position, FxVector? align = null, PxRect? sampleRect = null, DrawColor? color = null, float rotation = 0, FxVector? scale = null);
Пример #6
0
 public abstract void Draw(DrawContext context, PxRect rect, PxRect? sampleRect = null, DrawColor? color = null);
Пример #7
0
 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);
 }
Пример #8
0
 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);
 }
Пример #9
0
 public override void Draw(DrawContext context, PxRect rect, PxRect? sampleRect = null, DrawColor? color = null)
 {
     throw new NotImplementedException();
 }
Пример #10
0
 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);
 }
Пример #11
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());
 }
Пример #12
0
 public static void Clear(RenderTarget2D tgt, DrawColor color)
 {
     Clear(tgt, color.Color());
 }
Пример #13
0
 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();
 }
Пример #14
0
 public override void Draw(DrawContext context, PxRect rect, PxRect? sampleRect = null, DrawColor? color = null)
 {
     inner.Draw(context, rect, sampleRect, color);
 }
Пример #15
0
 public override void Draw(DrawContext context, PxRect rect, PxRect? sampleRect = null, DrawColor? color = null)
 {
     context.Set();
     DrawBatch.Draw(texture, rect, sampleRect, color);
 }
Пример #16
0
 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);
 }
Пример #17
0
 public override void Clear(DrawColor color)
 {
     DrawBatch.Clear(target, color.Color());
 }