Exemple #1
0
        static Bitmap RenderColorBmp(TerrainTile[,] tiles)
        {
            int          w    = tiles.GetLength(0);
            int          h    = tiles.GetLength(1);
            Bitmap       bmp  = new Bitmap(w, h);
            BitmapBuffer buff = new BitmapBuffer(bmp);

            buff.Lock();
            for (int y = 0; y < w; y++)
            {
                for (int x = 0; x < h; x++)
                {
                    buff[x, y] = TileTypes.color[tiles[x, y].TileId];
                }
            }
            buff.Unlock();
            return(bmp);
        }
Exemple #2
0
        static Bitmap RenderNoiseBmp(int w, int h)
        {
            Bitmap       bmp  = new Bitmap(w, h);
            BitmapBuffer buff = new BitmapBuffer(bmp);

            buff.Lock();
            var noise = new Noise(Environment.TickCount);

            for (int y = 0; y < w; y++)
            {
                for (int x = 0; x < h; x++)
                {
                    uint color = 0x00ffffff;
                    color     |= (uint)(noise.GetNoise(x / (double)w * 2, y / (double)h * 2, 0) * 255) << 24;
                    buff[x, y] = color;
                }
            }
            buff.Unlock();
            return(bmp);
        }
Exemple #3
0
        static Bitmap RenderEvalBmp(TerrainTile[,] tiles)
        {
            int          w    = tiles.GetLength(0);
            int          h    = tiles.GetLength(1);
            Bitmap       bmp  = new Bitmap(w, h);
            BitmapBuffer buff = new BitmapBuffer(bmp);

            buff.Lock();
            for (int y = 0; y < w; y++)
            {
                for (int x = 0; x < h; x++)
                {
                    uint color = 0x00ffffff;
                    color     |= (uint)((byte)(tiles[x, y].Elevation * 255) << 24);
                    buff[x, y] = color;
                }
            }
            buff.Unlock();
            return(bmp);
        }
Exemple #4
0
 static Bitmap RenderTerrainBmp(TerrainTile[,] tiles)
 {
     int w = tiles.GetLength(0);
     int h = tiles.GetLength(1);
     Bitmap bmp = new Bitmap(w, h);
     BitmapBuffer buff = new BitmapBuffer(bmp);
     buff.Lock();
     for (int y = 0; y < w; y++)
         for (int x = 0; x < h; x++)
         {
             buff[x, y] = TileTypes.terrainColor[tiles[x, y].Terrain];
         }
     buff.Unlock();
     return bmp;
 }
Exemple #5
0
 static Bitmap RenderNoiseBmp(int w, int h)
 {
     Bitmap bmp = new Bitmap(w, h);
     BitmapBuffer buff = new BitmapBuffer(bmp);
     buff.Lock();
     var noise = new Noise(Environment.TickCount);
     for (int y = 0; y < w; y++)
         for (int x = 0; x < h; x++)
         {
             uint color = 0x00ffffff;
             color |= (uint)(noise.GetNoise(x / (double)w * 2, y / (double)h * 2, 0) * 255) << 24;
             buff[x, y] = color;
         }
     buff.Unlock();
     return bmp;
 }
Exemple #6
0
 static Bitmap RenderMoistBmp(TerrainTile[,] tiles)
 {
     int w = tiles.GetLength(0);
     int h = tiles.GetLength(1);
     Bitmap bmp = new Bitmap(w, h);
     BitmapBuffer buff = new BitmapBuffer(bmp);
     buff.Lock();
     for (int y = 0; y < w; y++)
         for (int x = 0; x < h; x++)
         {
             uint color = 0x00ffffff;
             color |= (uint)(tiles[x, y].Moisture * 255) << 24;
             buff[x, y] = color;
         }
     buff.Unlock();
     return bmp;
 }