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);
        }
Exemple #2
0
 public static void BeginCanvas(Canvas canvas, Color clearColor, BlendState blendState)
 {
     SetTarget(canvas);
     Clear(clearColor);
     Draw.SpriteBatch.Begin(SpriteSortMode.Deferred, blendState, SamplerState.PointClamp, DepthStencilState.None, RasterizerState.CullNone);
 }
Exemple #3
0
 public static void SetTarget(Canvas canvas)
 {
     Engine.Instance.GraphicsDevice.SetRenderTarget(canvas.RenderTarget2D);
 }
 public void Resize(int width, int height)
 {
     if (Width != width || Height != height)
     {
         canvas.Unload();
         canvas = new Canvas(width, height);
         UpdateBuffer();
     }
 }
 public void Resize(int width, int height, int offsetX, int offsetY)
 {
     if (Width != width || Height != height || OffsetX != offsetX || OffsetY != offsetY)
     {
         canvas.Unload();
         canvas = new Canvas(width, height);
         SetOffsets(offsetX, offsetY);
     }
 }
 public Tilemap(int width, int height)
     : base(false)
 {
     Canvas = new Canvas(width, height);
 }