public TerrainRenderer(World world, WorldRenderer wr) { theater = wr.Theater; mapTiles = world.Map.MapTiles.Value; terrain = new TerrainSpriteLayer(world, wr, theater.Sheet, BlendMode.Alpha, wr.Palette("terrain"), wr.World.Type != WorldType.Editor); foreach (var cell in world.Map.AllCells) UpdateCell(cell); world.Map.MapTiles.Value.CellEntryChanged += UpdateCell; world.Map.MapHeight.Value.CellEntryChanged += UpdateCell; }
internal WorldRenderer(World world) { this.world = world; Viewport = new Viewport(this, world.Map); palette = new HardwarePalette(); palettes = new Dictionary<string, PaletteReference>(); foreach (var pal in world.traitDict.ActorsWithTrait<ILoadsPalettes>()) pal.Trait.LoadPalettes(this); palette.Initialize(); Theater = new Theater(world.TileSet); terrainRenderer = new TerrainRenderer(world, this); devTrait = Exts.Lazy(() => world.LocalPlayer != null ? world.LocalPlayer.PlayerActor.Trait<DeveloperMode>() : null); }
internal WorldRenderer(World world) { this.world = world; Viewport = new Viewport(this, world.Map); palette = new HardwarePalette(); palettes = new Cache<string, PaletteReference>(CreatePaletteReference); foreach (var pal in world.traitDict.ActorsWithTraitMultiple<IPalette>(world)) pal.Trait.InitPalette(this); palette.Initialize(); Theater = new Theater(world.TileSet); terrainRenderer = new TerrainRenderer(world, this); devTrait = Lazy.New(() => world.LocalPlayer != null ? world.LocalPlayer.PlayerActor.Trait<DeveloperMode>() : null); }
public TerrainRenderer(World world, WorldRenderer wr) { map = world.Map; theater = wr.Theater; foreach (var template in map.Rules.TileSet.Templates) { var palette = template.Value.Palette ?? TileSet.TerrainPaletteInternalName; spriteLayers.GetOrAdd(palette, pal => new TerrainSpriteLayer(world, wr, theater.Sheet, BlendMode.Alpha, wr.Palette(palette), world.Type != WorldType.Editor)); } foreach (var cell in map.AllCells) UpdateCell(cell); map.Tiles.CellEntryChanged += UpdateCell; map.Height.CellEntryChanged += UpdateCell; }
internal WorldRenderer(World world) { World = world; Viewport = new Viewport(this, world.Map); createPaletteReference = CreatePaletteReference; foreach (var pal in world.TraitDict.ActorsWithTrait<ILoadsPalettes>()) pal.Trait.LoadPalettes(this); foreach (var p in world.Players) UpdatePalettesForPlayer(p.InternalName, p.Color, false); palette.Initialize(); Theater = new Theater(world.TileSet); terrainRenderer = new TerrainRenderer(world, this); devTrait = Exts.Lazy(() => world.LocalPlayer != null ? world.LocalPlayer.PlayerActor.Trait<DeveloperMode>() : null); }
public TerrainRenderer(World world, WorldRenderer wr) { worldRenderer = wr; theater = wr.Theater; map = world.Map; mapTiles = map.MapTiles.Value; terrainPaletteIndex = wr.Palette("terrain").TextureIndex; rowStride = 4 * map.Bounds.Width; vertexBuffer = Game.Renderer.Device.CreateVertexBuffer(rowStride * map.Bounds.Height); UpdateMap(); map.MapTiles.Value.CellEntryChanged += UpdateCell; map.MapHeight.Value.CellEntryChanged += UpdateCell; wr.PaletteInvalidated += () => { terrainPaletteIndex = wr.Palette("terrain").TextureIndex; UpdateMap(); }; }
internal WorldRenderer(ModData modData, World world) { World = world; TileSize = World.Map.Grid.TileSize; Viewport = new Viewport(this, world.Map); createPaletteReference = CreatePaletteReference; var mapGrid = modData.Manifest.Get<MapGrid>(); enableDepthBuffer = mapGrid.EnableDepthBuffer; foreach (var pal in world.TraitDict.ActorsWithTrait<ILoadsPalettes>()) pal.Trait.LoadPalettes(this); foreach (var p in world.Players) UpdatePalettesForPlayer(p.InternalName, p.Color, false); palette.Initialize(); Theater = new Theater(world.Map.Rules.TileSet); terrainRenderer = new TerrainRenderer(world, this); devTrait = Exts.Lazy(() => world.LocalPlayer != null ? world.LocalPlayer.PlayerActor.Trait<DeveloperMode>() : null); }
internal WorldRenderer(World world) { World = world; Viewport = new Viewport(this, world.Map); createPaletteReference = CreatePaletteReference; foreach (var pal in world.TraitDict.ActorsWithTrait <ILoadsPalettes>()) { pal.Trait.LoadPalettes(this); } foreach (var p in world.Players) { UpdatePalettesForPlayer(p.InternalName, p.Color, false); } palette.Initialize(); Theater = new Theater(world.TileSet); terrainRenderer = new TerrainRenderer(world, this); devTrait = Exts.Lazy(() => world.LocalPlayer != null ? world.LocalPlayer.PlayerActor.Trait <DeveloperMode>() : null); }
public void WorldLoaded(World w, WorldRenderer wr) { theater = wr.Theater; render = new TerrainSpriteLayer(w, wr, theater.Sheet, BlendMode.Alpha, wr.Palette(info.Palette), wr.World.Type != WorldType.Editor); }