private void button1_Click(object sender, EventArgs e) { _map = new WorldPlan(new GenerationParameters { MapSize = new Vector2I((int)numericUpDown1.Value, (int)numericUpDown2.Value), CenterElevation = centerElevationCheck.Checked, ElevationSeed = (int)voronoiSeedNumeric.Value, GridSeed = (int)voronoiSeedNumeric.Value, PolygonsCount = (int)voronoiPolyNumeric.Value, RelaxCount = 3 }); //_map.RenderMapTemplate = Resources.mapbg; //_map.RenderContinentTemplate = Resources.brush; //_map.RenderWavePatterns = new [] { Resources.wavePattern, Resources.wavePattern1, Resources.wavePattern2}; //_map.RenderForest = Resources.forest; //_map.RenderTropicalForest = Resources.tropicForest; var sw = Stopwatch.StartNew(); _map.Generate(); sw.Stop(); genTimeLabel.Text = sw.Elapsed.TotalMilliseconds.ToString() + " ms"; pictureBox1.Image = _map.Render(); }
private void button2_Click(object sender, EventArgs e) { openFileDialog1.Filter = "*.umap|*.umap"; openFileDialog1.Title = "Select map to load"; if (openFileDialog1.ShowDialog() == DialogResult.OK) { using (var fs = File.OpenRead(openFileDialog1.FileName)) { using (GZipStream zip = new GZipStream(fs, CompressionMode.Decompress)) { XmlSerializer serializer = new XmlSerializer(typeof(WorldPlan)); _map = (WorldPlan)serializer.Deserialize(zip); } } pictureBox1.Image = _map.Render(); } }
public override void Initialize() { // TODO: need to make it async _planGenerator.Generate(); _mapImage = _planGenerator.Render(); }