void RenderRaster() { var map = ras.ExportMap(); int w = map.GetUpperBound(0) + 1, h = map.GetUpperBound(1) + 1; var bmp = new Bitmap(w * ScaleFactor, h * ScaleFactor); for (int x = 0; x < w; x++) { for (int y = 0; y < h; y++) { var type = map[x, y].TileType; if (type.Id != 0xfe && type.Name != null) { for (int dx = 0; dx < ScaleFactor; dx++) { for (int dy = 0; dy < ScaleFactor; dy++) { bmp.SetPixel(x * ScaleFactor + dx, y * ScaleFactor + dy, Color.FromArgb(type.Name.GetHashCode() & 0x00ffffff | (0xff << 24))); } } } } } var original = box.Image; box.Image = bmp; if (original != null) { original.Dispose(); } }
protected void FromDungeonGen(int seed, DungeonTemplate template) { Log.InfoFormat("Loading template for world {0}({1})...", Id, Name); var gen = new Generator(seed, template); gen.Generate(); var ras = new Rasterizer(seed, gen.ExportGraph()); ras.Rasterize(); var dTiles = ras.ExportMap(); if (Map == null) { Map = new Wmap(Manager.Resources.GameData); Interlocked.Add(ref _entityInc, Map.Load(dTiles, _entityInc)); if (Blocking == 3) { Sight.CalcRegionBlocks(Map); } } else { Map.ResetTiles(); } InitMap(); }