public SingleTileBrush(Tileset owner) : base("Single", BrushResizeMode.NoResize, owner) { // Initialize non changing data of the args. // TODO: args could have immutable members. args = new PaintArgs(); args.PaintType = PaintType.Texture; args.TexturePaintArgs.Tileset = Owner; }
private PaintArgs CreateNewArgs() { PaintArgs args = new PaintArgs(); args.PaintType = PaintType.Texture; args.TexturePaintArgs.Tileset = Owner; return(args); }
public SingleIndexMultipleTilesBrush(int width, int height, BrushResizeMode resizeMode, string name, Tileset owner) : base(name, resizeMode, owner) { this.width = width; this.height = height; args = new PaintArgs(); args.PaintType = PaintType.Texture; args.TexturePaintArgs.Tileset = owner; }
protected override void OnSelectedIndexChanged(int newX, int newY) { // Update source indices of all args. for (int i = 0; i < height; i++) { for (int j = 0; j < width; j++) { int k = i * height + j; PaintArgs args = paintArgs[k]; args.TexturePaintArgs.SourceIndex.X = newX + j; args.TexturePaintArgs.SourceIndex.Y = newY + i; } } }
protected override PaintArgs OnPaint() { // Get next arg and return it. PaintArgs args = paintArgs[argsCount]; argsCount++; if (argsCount >= width * height) { // Finished painting. argsCount = 0; FinishPainting(); } return(args); }