/// <summary> /// Creates a new handler component. /// </summary> /// <param name="exploredColorTint"> /// Color to use for tinting. Should generally be partially transparent. /// Defaults to (0.05f, 0.05f, 0.05f, 0.75f). /// </param> /// <param name="tintGlyph"> /// Glyph to use for tinting squares; should generally be a fully solid glyph. /// </param> /// <param name="startingState">The starting value for <see cref="FieldOfViewHandlerBase.CurrentState"/>.</param> public BasicFieldOfViewHandler(Color?exploredColorTint = null, int tintGlyph = 219, State startingState = State.Enabled) : base(startingState) { ExploredDecorator = new CellDecorator( exploredColorTint ?? new Color(0.05f, 0.05f, 0.05f, 0.75f), tintGlyph, Mirror.None); }
static void Init() { var fontMaster = SadConsole.Global.LoadFont("Fonts/font-sample_extended.font"); SadConsole.Global.FontDefault = fontMaster.GetFont(Font.FontSizes.One); var console = new Console(80, 25); console.Fill(Color.White, Color.Black, 0); Cell cell = new Cell(Color.White, Color.Black, 10); CellDecorator cellDec1 = new CellDecorator(Color.White, 256, Microsoft.Xna.Framework.Graphics.SpriteEffects.None); CellDecorator cellDec2 = new CellDecorator(Color.White, 257, Microsoft.Xna.Framework.Graphics.SpriteEffects.None); CellDecorator cellDec3 = new CellDecorator(Color.White, 258, Microsoft.Xna.Framework.Graphics.SpriteEffects.None); CellDecorator cellDec4 = new CellDecorator(Color.White, 259, Microsoft.Xna.Framework.Graphics.SpriteEffects.None); CellDecorator[] cDArray = new CellDecorator[4]; cDArray[0] = cellDec1; cDArray[1] = cellDec2; cDArray[2] = cellDec3; cDArray[3] = cellDec4; CellState cellState = new CellState(Color.White, Color.Black, 10, Microsoft.Xna.Framework.Graphics.SpriteEffects.None, true, cDArray); cell.RestoreState(ref cellState); console.IsFocused = true; console.Components.Add(new MyKeyboardComponent()); Player.Entity = new SadConsole.Entities.Entity(Color.White, Color.Black, 64); Player.Entity.Parent = console; Player.Entity.Position = new Point(5, 2); Player.MovementHandler = new MovementHandler(new Point(5, 2), 0); console.Print(7, 7, "A", Color.White, Color.Black); console.SetDecorator(7, 7, 1, cDArray); Map maptest = new Map(80, 25); World.ActualMap = maptest; Random rnd = new Random(); for (int i = 0; i < 80; i++) { for (int j = 0; j < 25; j++) { TerrainInfo ti = new TerrainInfo(); ti.Height = 0; ti.PassableNorth = true; ti.PassableWest = true; ti.PassableSouth = true; ti.PassableEast = true; ti.Obstacle = rnd.NextDouble() > 0.7; if (j == 0 || j == 24 || i == 0 || i == 79) { ti.Obstacle = true; } maptest[i, j] = ti; } } maptest.Refresh(); maptest.MapConsole.Parent = console; maptest.MapConsole.Position = new Point(0, 0); SadConsole.Global.CurrentScreen = console; }