private void Draw(ScreenDrawingSurface surface, int tile_x, int tile_y) { // first track the changes i'm going to make for undo purposes foreach (TileBrushCell cell in brush.Cells()) { int tx = cell.x + tile_x; int ty = cell.y + tile_y; if (tx < 0 || tx >= surface.Screen.Width || ty < 0 || ty >= surface.Screen.Height) { continue; } if (startTiles[tx, ty] == null) // don't overwrite existing data { startTiles[tx, ty] = surface.Screen.TileAt(tx, ty).Id; } endTiles[tx, ty] = cell.tile.Id; } brush.DrawOn(surface.Screen, tile_x, tile_y); surface.ReDrawTiles(); }
public Bucket(ITileBrush brush) { width = brush.Width; height = brush.Height; cells = new Tile[width, height]; foreach (TileBrushCell cell in brush.Cells()) { cells[cell.x, cell.y] = cell.tile; } Icon = new Bitmap(brush.Width * brush.CellSize, brush.Height * brush.CellSize); using (Graphics g = Graphics.FromImage(Icon)) { brush.DrawOn(g, 0, 0); } changes = new List <TileChange>(); }
public Bucket(ITileBrush brush) { width = brush.Width; height = brush.Height; cells = new Tile[width, height]; foreach (TileBrushCell cell in brush.Cells()) { cells[cell.x, cell.y] = cell.tile; } Icon = new Bitmap(brush.Width * brush.CellSize, brush.Height * brush.CellSize); using (Graphics g = Graphics.FromImage(Icon)) { brush.DrawOn(g, 0, 0); } changes = new List<TileChange>(); }