Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void BuildCompleteTexture(GraphicsDevice device)
- {
- int dim = gridSize * tileSize;
- // Wir erzeugen eine blanke Textur in der Größe des Applikationsfensters
- Texture2D map = new Texture2D(device, dim, dim);
- for (int row = 0; row < gridSize; row++)
- {
- for (int col = 0; col < gridSize; col++)
- {
- // wir holen uns die Farbe des Terrains
- byte terrainType = (byte)noiseMap.GetMapValue(row, col);
- // definieren ein Rechteck in der richtigen Größe
- Rectangle rect = new Rectangle(row * tileSize, col * tileSize, tileSize, tileSize);
- Color color = TileMap[row, col];
- Color[] arr = new Color[tileSize * tileSize];
- for (int i = 0; i < tileSize * tileSize; i++)
- arr[i] = color;
- // und zeichnen die Farbe in der Größe des Rechtecks sie an die richtige Stelle auf der blanken Textur
- map.SetData<Color>(0, rect, arr, 0, tileSize * tileSize);
- }
- }
- Texture = map;
- }
Advertisement
Add Comment
Please, Sign In to add comment