public void DrawSerpentCell(Serpent serpent, int idx) { Cell cell = serpent.GetCell(idx); Rectangle rect = GetCellRect(cell.Row, cell.Col); RelateDirection before = serpent.GetCellRelation(idx, -1); RelateDirection after = serpent.GetCellRelation(idx, 1); cell.Draw(_graphic, rect, CellMargin, idx, before, after); }
public void DrawSerpentCells(Serpent serpent) { for (int i = 0; i < serpent.Body.Count; i++) { Cell cell = serpent.Body[i]; Rectangle rect = GetCellRect(cell.Row, cell.Col); RelateDirection before = serpent.GetCellRelation(i, -1); RelateDirection after = serpent.GetCellRelation(i, 1); cell.Draw(_graphic, rect, CellMargin, i, before, after); } }
public void DrawSerpentCells2(Serpent serpent) { Graphics g = Graphics.FromImage(_bitmap); for (int i = 0; i < serpent.Body.Count; i++) { Cell cell = serpent.Body[i]; Rectangle rect = GetCellRect(cell.Row, cell.Col); RelateDirection before = serpent.GetCellRelation(i, -1); RelateDirection after = serpent.GetCellRelation(i, 1); cell.Draw(g, rect, CellMargin, i, before, after); } g.Dispose(); _graphic.DrawImage(_bitmap, 0, 0); }