// Methods public void createGrid() { // Create tiles tiles = new Tile[mNumRows, mNumColumns]; // Rows for (int i = 0; i < mNumRows; i++) { // Columns for (int j = 0; j < mNumColumns; j++) { tiles[i, j] = new Tile(); } } }
// Screen Size; // // public void drawTiles(Tile[,] tiles, Graphics g) { graphics = g; int indexX = 0, indexY = 0; // indexes int height = 75; int width = 75; for (int x = 0; x < 5; x++) { for(int y = 0; y < 5; y++) { Brush borderColor = tiles[indexX, indexY].getBorderColor(); Brush bgcolor = tiles[indexX, indexY].getBackgroundColor(); Gem[] gems = tiles[indexX, indexY].getGems(); //Console.WriteLine("APPLES " + indexX + " " + indexY + " " + tiles[indexX, indexY].getBorderColor().ToString()); //Brush borderColor = Brushes.Black; //Brush bgcolor = Brushes.Orange; graphics.DrawRectangle(new Pen(borderColor, 5), ((height + 10) * x) + 20, ((width + 10) * y) + 20, width, height); graphics.FillRectangle(bgcolor, ((height + 10) * x) + 20, ((width + 10) * y) + 20, width, height); Random r = new Random(); int rand = r.Next() % 100; if (rand % 2 != 0) { if (gems[0].getGemImagePath() != null) { Image image = Image.FromFile(gems[0].getGemImagePath()); graphics.DrawImage(image, ((height + 10) * x) + 20, ((width + 10) * y) + 20, 20, 20); } } indexY++; } indexX++; indexY = 0; } graphics.DrawRectangle(new Pen(Brushes.Khaki, 5), 10, 10, ((height) * 5) + 60, ((width) * 5) + 60); }