Esempio n. 1
0
 /// <summary>
 /// Loads a PNG image from a file identified by the path parameter.
 /// </summary>
 /// <param name="path"></param>
 /// <returns></returns>
 public static PngImage Load(string path)
 {
     byte[] buffer = null;
     using (System.IO.FileStream stream = new System.IO.FileStream(path, System.IO.FileMode.Open))
     {
         using (System.IO.BinaryReader reader = new System.IO.BinaryReader(stream))
         {
             int length = (int)new System.IO.FileInfo(path).Length;
             buffer = reader.ReadBytes((int)length);
         }
     }
     PngImage image = new PngImage(buffer, false);
     return image;
 }
Esempio n. 2
0
        /// <summary>
        /// Initialized the test terrain library.
        /// </summary>
        private void CreateTestLibrary()
        {
            testLibrary = new Library();
            Descriptor desc = new Descriptor();
            desc.Name = "Small Scale Landscape";
            desc.Description = "Terrain library suitable for small scale maps.";
            testLibrary.Descriptor = desc;

            Terrain t = new Terrain();
            desc = new Descriptor();
            t.Descriptor = desc;
            desc.Name = "Grasslands";
            desc.Description = "Grasslands or open plains";
            t.SurfaceColor = new ColorARGB("#ffb5cf7c");
            testLibrary.Add(t);

            t = new Terrain();
            desc = new Descriptor();
            t.Descriptor = desc;
            desc.Name = "Forest";
            desc.Description = "Forested area populated with mostly deciduous trees";
            t.SurfaceColor = new ColorARGB("#ff879959");
            testLibrary.Add(t);
            PngImage surfaceFeature = new PngImage(File.ReadAllBytes(@"Assets\set00-trn01-ftr01.png"));
            t.AddSurfaceFeature(new Terrain.SurfaceFeature(surfaceFeature));

            t = new Terrain();
            desc = new Descriptor();
            t.Descriptor = desc;
            desc.Name = "Dense Forest";
            desc.Description = "Dense, old growth forest with deciduous trees";
            t.SurfaceColor = new ColorARGB("#ff556332");
            testLibrary.Add(t);
            surfaceFeature = new PngImage(File.ReadAllBytes(@"Assets\DenseForest-001.png"));
            t.AddSurfaceFeature(new Terrain.SurfaceFeature(surfaceFeature));

            t = new Terrain();
            desc = new Descriptor();
            t.Descriptor = desc;
            desc.Name = "Mountains";
            desc.Description = "Mountains with little or, no vegitation.";
            t.SurfaceColor = new ColorARGB("#ffa67048");
            testLibrary.Add(t);

            t = new Terrain();
            desc = new Descriptor();
            t.Descriptor = desc;
            desc.Name = "Marsh";
            desc.Description = "Temperate climate marsh or moors.";
            t.SurfaceColor = new ColorARGB("#ff8bd4cb");
            testLibrary.Add(t);
            surfaceFeature = new PngImage(File.ReadAllBytes(@"Assets\set00-trn03-ftr01.png"));
            t.AddSurfaceFeature(new Terrain.SurfaceFeature(surfaceFeature));

            t = new Terrain();
            desc = new Descriptor();
            t.Descriptor = desc;
            desc.Name = "Desert";
            desc.Description = "Sandy desert with little or, no vegitation.";
            t.SurfaceColor = new ColorARGB("#ffd1c0a1");
            testLibrary.Add(t);

            t = new Terrain();
            desc = new Descriptor();
            t.Descriptor = desc;
            desc.Name = "Water";
            desc.Description = "Water. Typically shallow with a depth of less than 50 meters";
            t.SurfaceColor = new ColorARGB("#ff6ccdf1");
            testLibrary.Add(t);

            t = new Terrain();
            desc = new Descriptor();
            t.Descriptor = desc;
            desc.Name = "Deep Water";
            desc.Description = "Water, typically with a depth of more than 50 meters";
            t.SurfaceColor = new ColorARGB("#ff308aab");
            testLibrary.Add(t);
        }
Esempio n. 3
0
 public SurfaceFeature(PngImage image)
 {
     id = Guid.NewGuid();
     this.image = image;
 }