示例#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());
 }