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 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); }
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); }