protected virtual void setDefault() { for (int row = 0; row < map.Height; row++) { for (int col = 0; col < map.Width; col++) { outGrid.setTile(row, col, 0.0f); } } }
//Events private void Canvas_Load(object sender, EventArgs e) { if (!node.editedOnce) //If this is the first time editing, create a new image. { WidthHeightDialog dialog = new WidthHeightDialog(); dialog.ShowDialog(); image = new RectGrid(dialog.height, dialog.width); } else //If we've already made one, copy the existing one so we can edit it. { image = new RectGrid(node.Grid.Height, node.Grid.Width); for (int r = 0; r < node.Grid.Height; r++) { for (int c = 0; c < node.Grid.Width; c++) { float val = node.Grid.getTile(r, c).Value; image.setTile(r, c, val); } } } //Put the image in the picbox tempPicBox.Image = image.gridToBitmap(); //Enable the timer tickTimer.Enabled = true; //Set default brush params brushSpeedBox.Minimum = (decimal)MIN_BRUSH_SPEED; brushSpeedBox.Maximum = (decimal)MAX_BRUSH_SPEED; brushSize = DEFAULT_SIZE; brushSpeed = DEFAULT_SPEED; //Add all brush types AddBrushType("Circle", new CircleBrush()).Checked = true; AddBrushType("Square", new SquareBrush()); //Add all tools AddTool("Paint Brush", PaintBrushTool).Checked = true; AddTool("Eraser", EraserTool); }