public void GenerateImageGrid(LevelGrid levelGrid, Dictionary <int, Image> intToImageDictionary, int blockWidth = 20, int blockHeight = 20) { Image[,] images = levelGrid.GetImageLevelGrid(intToImageDictionary); levelImages.Clear(); levelRectangles.Clear(); for (int i = 0; i < images.GetLength(0); ++i) { for (int j = 0; j < images.GetLength(1); ++j) { Rectangle r = new Rectangle(i * blockWidth + XOffset, j * blockHeight + YOffset, blockWidth, blockHeight); Pen p = new Pen(Color.Black); levelRectangles.Add(r); if (levelGrid.GetIntValueAt(i, j) != 0) { Image imageToDraw = images[i, j]; if (imageToDraw != null) { levelImages.Add(r, imageToDraw); } } } } }
public Controller() { LevelGrid.SetWidth(STARTING_LEVEL_WIDTH); LevelGrid.SetHeight(STARTING_LEVEL_HEIGHT); }