public FadingChild() : base(80, 23) { Surface.FillWithRandomGarbage(Font); _child = new ScreenSurface(30, 13); _child.Surface.DefaultForeground = Color.White; _child.Surface.DefaultBackground = Color.Black; _child.Surface.Clear(); _child.Surface.DrawBox(_child.Surface.View, new ColoredGlyph(Color.MediumPurple, Color.Black), connectedLineStyle: ICellSurface.ConnectedLineThick); _child.Surface.Print(2, 2, "Transparent console"); _child.Position = (40, 4); Children.Add(_child); _childTint = new ScreenSurface(30, 13); _childTint.Surface.DefaultForeground = Color.White; _childTint.Surface.DefaultBackground = Color.Black; _childTint.Surface.Clear(); _childTint.Surface.DrawBox(_child.Surface.View, new ColoredGlyph(Color.MediumPurple, Color.Black), connectedLineStyle: ICellSurface.ConnectedLineThick); _childTint.Surface.Print(2, 2, "Tinted console"); _childTint.Position = (4, 4); Children.Add(_childTint); _set = new SadConsole.Instructions.InstructionSet() .Instruct(new SadConsole.Instructions.AnimatedValue(TimeSpan.FromSeconds(1.5), 255, 0, new SadConsole.EasingFunctions.Linear())) .Instruct(new SadConsole.Instructions.AnimatedValue(TimeSpan.FromSeconds(1.5), 0, 255, new SadConsole.EasingFunctions.Linear())) ; _set.RepeatCount = -1; SadComponents.Add(_set); //_child.Tint = new Color(0, 127, 0, 127); }
private void On_GoRogueComponentRemoved(object?s, ComponentChangedEventArgs e) { if (e.Component is IComponent sadComponent) { SadComponents.Remove(sadComponent); } }
public MultiCursor() : base(80, 23) { CursorGreen = new SadConsole.Components.Cursor() { CursorRenderCell = new ColoredGlyph(Color.Green, Color.Transparent, SadConsole.Components.Cursor.DefaultCursorGlyph), PrintAppearance = new ColoredGlyph(Color.Green, Color.Transparent, SadConsole.Components.Cursor.DefaultCursorGlyph), IsEnabled = true, ApplyCursorEffect = true }; CursorYellow = new SadConsole.Components.Cursor() { CursorRenderCell = new ColoredGlyph(Color.Yellow, Color.Transparent, SadConsole.Components.Cursor.DefaultCursorGlyph), PrintAppearance = new ColoredGlyph(Color.Yellow, Color.Transparent, SadConsole.Components.Cursor.DefaultCursorGlyph), PrintOnlyCharacterData = false, IsEnabled = false, ApplyCursorEffect = false }; CursorPurple = new SadConsole.Components.Cursor() { CursorRenderCell = new ColoredGlyph(Color.Purple, Color.Transparent, SadConsole.Components.Cursor.DefaultCursorGlyph), PrintAppearance = new ColoredGlyph(Color.Purple, Color.Transparent, SadConsole.Components.Cursor.DefaultCursorGlyph), PrintOnlyCharacterData = false, IsEnabled = false, ApplyCursorEffect = false }; SadComponents.Add(CursorGreen); SadComponents.Add(CursorYellow); SadComponents.Add(CursorPurple); CursorGreen.Position = (23, 11); CursorYellow.Position = (11, 20); CursorPurple.Position = (2, 6); }
/// <summary> /// A new instance of this class. /// </summary> public Simple() : base(_title.Length, 1) { UsePixelPositioning = true; Position = (Settings.Rendering.RenderWidth / 2 - AbsoluteArea.Width / 2, Settings.Rendering.RenderHeight / 2 - AbsoluteArea.Height / 2); Surface.Print(0, 0, _title, Color.Black, Color.AnsiWhite); _endAnimation = new Instructions.InstructionSet() { RemoveOnFinished = true } .Instruct(new Instructions.FadeTextSurfaceTint(new ColorGradient(Settings.ClearColor.SetAlpha(0), Settings.ClearColor.SetAlpha(255)), System.TimeSpan.FromSeconds(1))) .Wait(System.TimeSpan.FromMilliseconds(0.500)) .Code((s, d) => { IsVisible = false; return(true); }); var endTimeout = new Instructions.InstructionSet() { RemoveOnFinished = true } .Wait(System.TimeSpan.FromSeconds(3)) .Code((s, d) => { _isEnding = true; SadComponents.Add(_endAnimation); return(true); }); var startAnimation = new Instructions.InstructionSet { RemoveOnFinished = true } .Instruct(new Instructions.FadeTextSurfaceTint(new ColorGradient(Settings.ClearColor.SetAlpha(255), Settings.ClearColor.SetAlpha(0)), System.TimeSpan.FromSeconds(1))) .Wait(System.TimeSpan.FromMilliseconds(0.500)); SadComponents.Add(startAnimation); SadComponents.Add(endTimeout); }
/// <summary> /// Creates a console with the specified width and height, with <see cref="Color.Transparent"/> for the background and <see cref="Color.White"/> for the foreground. /// </summary> /// <param name="width">The width of the console in cells.</param> /// <param name="height">The height of the console in cells.</param> /// <param name="bufferWidth">The total width of the console in cells.</param> /// <param name="bufferHeight">The total height of the console in cells.</param> /// <param name="initialCells">The cells to seed the console with. If <see langword="null"/>, creates the cells for you.</param> public Console(int width, int height, int bufferWidth, int bufferHeight, ColoredGlyph[] initialCells) : base(width, height, bufferWidth, bufferHeight, initialCells) { Cursor = new Cursor() { IsVisible = false, IsEnabled = false }; SadComponents.Add(Cursor); UseKeyboard = Settings.DefaultConsoleUseKeyboard; }
/// <summary> /// Creates a new console using the existing surface. /// </summary> /// <param name="surface">The surface.</param> /// <param name="font">The font to use with the surface.</param> /// <param name="fontSize">The font size.</param> public Console(ICellSurface surface, IFont font = null, Point?fontSize = null) : base(surface, font, fontSize) { Cursor = new Cursor() { IsVisible = false, IsEnabled = false }; SadComponents.Add(Cursor); UseKeyboard = Settings.DefaultConsoleUseKeyboard; }
private void OnDeserialized(StreamingContext context) { Cursor = SadComponents.OfType <Cursor>().FirstOrDefault(); if (Cursor == null) { throw new System.Exception("Cursor not deserialized. Perhaps it was removed? A cursor should always be available on the console."); } }
/// <summary> /// Ends the animation when a key is pressed. /// </summary> /// <param name="keyboard">The keyboard state.</param> /// <returns>The base implementation of the keyboard.</returns> public override bool ProcessKeyboard(Keyboard keyboard) { if (!_isEnding && keyboard.KeysReleased.Count != 0) { _isEnding = true; SadComponents.Add(_endAnimation); } return(base.ProcessKeyboard(keyboard)); }
public WorldPlay() { _tickManager = new SadConsoleComponents.TickManager(TimeSpan.FromSeconds(0.05)); SadComponents.Add(_tickManager); SadComponents.Add(new ChangeElementTypeMouseHandler()); GameBoards = new Dictionary <string, Board>(); UseMouse = true; }
public MainConsole(MapConsole mapConsole, LogConsole logConsole, MessageConsole messageConsole, StatusConsole statusConsole, KeyboardHandler keyboardHandler, InventoryConsole inventory) : base(80, 40) { this.mapConsole = mapConsole; this.logConsole = logConsole; this.messageConsole = messageConsole; this.statusConsole = statusConsole; this.inventory = inventory; this.Font = new Font(12, 12, 0, 16, 16, 0, new GameTexture(new SFML.Graphics.Texture("../../../Cheepicus_12x12.png")), "mapFont"); GameHost.Instance.FocusedScreenObjects.Set(this); keyboardHandlerObject = keyboardHandler; SadComponents.Add(keyboardHandlerObject); inventory.IsVisible = false; }
public AutoTypingConsole() : base(80, 23) { string[] text = new string[] { "[c:r f:ansiwhite]Welcome to the [c:g f:black:red:black:10][c:r b:White]SadConsole[c:u] starter project!", "", "Not only does the app demonstrate some of the things you can do with ", "[c:g f:black:red:black:10][c:r b:White]SadConsole[c:u], but it also provides code examples.", "", "To use this app, press [c:r f:red:2]F1 to to cycle to the next console. Here is a list of", "examples you will cycle through:", "", "[c:r f:LightGreen]01[c:r f:green])[c:u 2] Splash Screen -- [c:r f:white]Sample splash screen advertising [c:g f:black:red:black:10][c:r b:White]SadConsole[c:u 2]", "[c:r f:LightGreen]02[c:r f:green])[c:u 2] String Parser -- [c:r f:white]Examples of using the string parser functions[c:u]", "[c:r f:LightGreen]03[c:r f:green])[c:u 2] Shapes -- [c:r f:white]Draw different shapes[c:u]", "[c:r f:LightGreen]04[c:r f:green])[c:u 2] Controls Test -- [c:r f:white]Displays all SadConsole.Controls for testing[c:u]", "[c:r f:LightGreen]05[c:r f:green])[c:u 2] Scroll Control -- [c:r f:white]Single surface with multiple views + scrolling[c:u]", "[c:r f:LightGreen]06[c:r f:green])[c:u 2] Stretched Console -- [c:r f:white]Shows how to print with a font that x2 in size[c:u]", "[c:r f:LightGreen]07[c:r f:green])[c:u 2] Multiple Cursors -- [c:r f:white]Multiple cursors typing on a single console[c:u]", "[c:r f:LightGreen]08[c:r f:green])[c:u 2] DOS\\Terminal -- [c:r f:white]A terminal prompt that accepts commands[c:u]", "[c:r f:LightGreen]09[c:r f:green])[c:u 2] Transparent fade -- [c:r f:white]Demonstrates fading\\blending a console[c:u]", "[c:r f:LightGreen]10[c:r f:green])[c:u 2] 2000x2000 Console -- [c:r f:white]2000x2000 console that is scrollable[c:u]", "[c:r f:LightGreen]11[c:r f:green])[c:u 2] Serialization -- [c:r f:white]Uses SadConsole.Ansi to parse an ansi.sys art file[c:u]", "[c:r f:LightGreen]12[c:r f:green])[c:u 2] Entity demo -- [c:r f:white]1000s of entities on the screen moving around[c:u]", "[c:r f:LightGreen]13[c:r f:green])[c:u 2] Ansi console -- [c:r f:white]Uses SadConsole.Ansi to parse an ansi.sys art file[c:u]", "[c:r f:LightGreen]14[c:r f:green])[c:u 2] And more!!", }; // We want this to print on a sub region of the main console, so we'll create a sub view and use that typingInstruction = new SadConsole.Instructions.DrawString(SadConsole.ColoredString.Parse(string.Join("\r\n", text))); typingInstruction.TotalTimeToPrint = 8; // 0.5 seconds per line of text Cursor.Position = new SadRogue.Primitives.Point(1, 1); Cursor.IsEnabled = false; Cursor.IsVisible = true; typingInstruction.Cursor = Cursor; SadComponents.Add(typingInstruction); //Cursor.IsVisible = true; IsVisible = false; }
public EntityConsole() : base(80, 23, 160, 46) { player = new Entity(Color.Yellow, Color.Black, 1, 10) { Position = new Point(Surface.Width / 2, Surface.Height / 2), }; playerPreviousPosition = player.Position; SadComponents.Add(new SadConsole.Components.SurfaceComponentFollowTarget() { Target = player }); //player.Components.Add(new SadConsole.Components.EntityViewSync()); Children.Add(player); // Setup this console to accept keyboard input. UseKeyboard = true; IsVisible = false; }
// This console domonstrates a classic MS-DOS or Windows Command Prompt style console. public DOSConsole() : base(80, 23) { IsVisible = false; // This is our cusotmer keyboard handler we'll be using to process the cursor on this console. _keyboardHandlerObject = new InputHandling.ClassicConsoleKeyboardHandler(); // Our custom handler has a call back for processing the commands the user types. We could handle // this in any method object anywhere, but we've implemented it on this console directly. _keyboardHandlerObject.EnterPressedAction = EnterPressedActionHandler; // Enable the keyboard and setup the prompt. UseKeyboard = true; Cursor.IsVisible = true; Prompt = "Prompt> "; // Startup description ClearText(); // Disable the cursor since our keyboard handler will do the work. Cursor.IsEnabled = false; Cursor.Position = new Point(0, 24); Cursor.Print("Try typing in the following commands: help, ver, cls, look. If you type exit or quit, the program will end.").NewLine().NewLine(); _keyboardHandlerObject.CursorLastY = 24; TimesShiftedUp = 0; Cursor.DisableWordBreak = true; Cursor.Print(Prompt); Cursor.DisableWordBreak = false; // Assign our custom handler method from our handler object to this consoles keyboard handler. // We could have overridden the ProcessKeyboard method, but I wanted to demonstrate how you // can use your own handler on any console type. SadComponents.Add(_keyboardHandlerObject); }
public EntityZoneConsole() : base(80, 23, 160, 46) { player = new Entity(Color.Yellow, Color.Black, 1, 100) { //Position = new Point(Surface.BufferWidth / 2, Surface.BufferHeight / 2) Position = new Point(0, 0) }; Surface.DefaultBackground = Color.DarkGray; Surface.Clear(); playerPreviousPosition = player.Position; SadComponents.Add(new SadConsole.Components.SurfaceComponentFollowTarget() { Target = player }); entityManager = new Manager(); //SadComponents.Add(new SadConsole.Components.SurfaceComponentEntityOffsets()); SadComponents.Add(entityManager); //player.Components.Add(new SadConsole.Components.EntityViewSync()); entityManager.Add(player); Rectangle zone1 = new Rectangle(20, 10, 10, 5); Surface.Fill(zone1, background: Color.GreenYellow); entityManager.Add(new Zone(new Area(zone1.Positions()))); entityManager.EnterZone += EntityManager_EnterZone; entityManager.ExitZone += EntityManager_ExitZone; //Children.Add(player); // Setup this console to accept keyboard input. UseKeyboard = true; IsVisible = false; }
public ControlsTest() : base(80, 23) { var prog1 = new ProgressBar(10, 1, HorizontalAlignment.Left) { Position = new Point(16, 5) }; Controls.Add(prog1); var prog2 = new ProgressBar(1, 6, VerticalAlignment.Bottom) { Position = new Point(18, 7) }; Controls.Add(prog2); var slider = new ScrollBar(Orientation.Horizontal, 10) { Position = new Point(16, 3), Maximum = 18 }; Controls.Add(slider); slider = new ScrollBar(Orientation.Vertical, 6) { Position = new Point(16, 7), Maximum = 6 }; Controls.Add(slider); progressTimer = new SadConsole.Components.Timer(TimeSpan.FromSeconds(0.5)); progressTimer.TimerElapsed += (timer, e) => { prog1.Progress = prog1.Progress >= 1f ? 0f : prog1.Progress + 0.1f; prog2.Progress = prog2.Progress >= 1f ? 0f : prog2.Progress + 0.1f; }; SadComponents.Add(progressTimer); var listbox = new ListBox(20, 6) { Position = new Point(28, 3) }; listbox.Items.Add("item 1"); listbox.Items.Add("item 2"); listbox.Items.Add("item 3"); listbox.Items.Add("item 4"); listbox.Items.Add("item 5"); listbox.Items.Add("item 6"); listbox.Items.Add("item 7"); listbox.Items.Add("item 8"); listbox.Items.Add("item 9"); Controls.Add(listbox); var radioButton = new RadioButton(20, 1) { Text = "Group 1 Option 1", Position = new Point(28, 12) }; Controls.Add(radioButton); radioButton = new RadioButton(20, 1) { Text = "Group 1 Option 2", Position = new Point(28, 13) }; Controls.Add(radioButton); var selButton = new SelectionButton(24, 1) { Text = "Selection Button 1", Position = new Point(51, 3) }; Controls.Add(selButton); var selButton1 = new SelectionButton(24, 1) { Text = "Selection Button 2", Position = new Point(51, 4) }; Controls.Add(selButton1); var selButton2 = new SelectionButton(24, 1) { Text = "Selection Button 3", Position = new Point(51, 5) }; Controls.Add(selButton2); selButton.PreviousSelection = selButton2; selButton.NextSelection = selButton1; selButton1.PreviousSelection = selButton; selButton1.NextSelection = selButton2; selButton2.PreviousSelection = selButton1; selButton2.NextSelection = selButton; var input = new TextBox(10) { Position = new Point(51, 9) }; Controls.Add(input); var password = new TextBox(10) { Mask = '*', Position = new Point(65, 9) }; Controls.Add(password); var button = new Button(11, 1) { Text = "Click", Position = new Point(1, 3) }; button.Click += (s, a) => SadConsole.UI.Window.Message("This has been clicked -- and your password field contains '" + password.Text + "'", "Close"); Controls.Add(button); button = new Button(11, 3) { Text = "Click", Position = new Point(1, 5), Theme = new Button3dTheme() }; button.Click += (s, a) => listbox.ScrollToSelectedItem(); //button.AlternateFont = SadConsole.Global.LoadFont("Fonts/Cheepicus12.font").GetFont(Font.FontSizes.One); Controls.Add(button); button = new Button(11, 3) { Text = "Click", Position = new Point(1, 10), Theme = new ButtonLinesTheme() }; Controls.Add(button); var checkbox = new CheckBox(13, 1) { Text = "Check box", Position = new Point(51, 13) }; Controls.Add(checkbox); Controls.FocusedControl = null; //DisableControlFocusing = true; List <Tuple <Color, string> > colors = new List <Tuple <Color, string> > { new Tuple <Color, string>(Library.Default.Colors.Red, "Red"), new Tuple <Color, string>(Library.Default.Colors.RedDark, "DRed"), new Tuple <Color, string>(Library.Default.Colors.Purple, "Prp"), new Tuple <Color, string>(Library.Default.Colors.PurpleDark, "DPrp"), new Tuple <Color, string>(Library.Default.Colors.Blue, "Blu"), new Tuple <Color, string>(Library.Default.Colors.BlueDark, "DBlu"), new Tuple <Color, string>(Library.Default.Colors.Cyan, "Cya"), new Tuple <Color, string>(Library.Default.Colors.CyanDark, "DCya"), new Tuple <Color, string>(Library.Default.Colors.Green, "Gre"), new Tuple <Color, string>(Library.Default.Colors.GreenDark, "DGre"), new Tuple <Color, string>(Library.Default.Colors.Yellow, "Yel"), new Tuple <Color, string>(Library.Default.Colors.YellowDark, "DYel"), new Tuple <Color, string>(Library.Default.Colors.Orange, "Ora"), new Tuple <Color, string>(Library.Default.Colors.OrangeDark, "DOra"), new Tuple <Color, string>(Library.Default.Colors.Brown, "Bro"), new Tuple <Color, string>(Library.Default.Colors.BrownDark, "DBrow"), new Tuple <Color, string>(Library.Default.Colors.Gray, "Gray"), new Tuple <Color, string>(Library.Default.Colors.GrayDark, "DGray"), new Tuple <Color, string>(Library.Default.Colors.White, "White"), new Tuple <Color, string>(Library.Default.Colors.Black, "Black") }; backgroundcycle = colors.Select(i => i.Item1).ToArray(); backIndex = 5; //int y = 25 - 20; //int x = 0; //int colorLength = 4; //foreach (var color1 in colors) //{ // foreach (var color2 in colors) // { // _Print(x, y, new ColoredString(color2.Item2.PadRight(colorLength).Substring(0, colorLength), color2.Item1, color1.Item1, null)); // y++; // } // y = 25 -20; // x += colorLength; //} OnInvalidated(); }
public EntityLiteConsole() : base(80, 23, 160, 46) { var fadeEffect = new SadConsole.Effects.Fade { AutoReverse = true, DestinationForeground = new ColorGradient(Color.Blue, Color.Yellow), FadeForeground = true, UseCellForeground = false, Repeat = true, FadeDuration = 0.7f, RemoveOnFinished = true, CloneOnAdd = true }; player = new Entity(Color.Yellow, Color.Black, 1, 100) { //Position = new Point(Surface.BufferWidth / 2, Surface.BufferHeight / 2) Position = new Point(0, 0), UsePixelPositioning = usePixelPositioning, }; // If we're allowing smooth movements, add the component if (useSmoothMovements) { player.SadComponents.Add(new SadConsole.Components.SmoothMove(FontSize, new TimeSpan(0, 0, 0, 0, 300))); } Surface.DefaultBackground = Color.DarkGray; Surface.Clear(); playerPreviousPosition = player.Position; SadComponents.Add(new SadConsole.Components.SurfaceComponentFollowTarget() { Target = player }); entityManager = new Renderer(); //SadComponents.Add(new SadConsole.Components.SurfaceComponentEntityOffsets()); SadComponents.Add(entityManager); //player.Components.Add(new SadConsole.Components.EntityViewSync()); entityManager.Add(player); //Children.Add(player); others = new List <Entity>(); for (int i = 0; i < 1000; i++) { var item = new Entity(Color.Red.GetRandomColor(SadConsole.Game.Instance.Random), Color.Black, Game.Instance.Random.Next(0, 60), 0) { Position = GetRandomPosition(), UsePixelPositioning = usePixelPositioning, }; if (useSmoothMovements) { item.SadComponents.Add(new SadConsole.Components.SmoothMove(FontSize, new TimeSpan(0, 0, 0, 0, 300))); } if (Game.Instance.Random.Next(0, 500) < 50) { item.Effect = fadeEffect; } entityManager.Add(item); others.Add(item); } // Setup this console to accept keyboard input. UseKeyboard = true; IsVisible = false; }
/// <summary> /// Creates a new console using the existing surface. /// </summary> /// <param name="surface">The surface.</param> /// <param name="font">The font to use with the surface.</param> /// <param name="fontSize">The font size.</param> public ControlsConsole(ICellSurface surface, IFont font = null, Point?fontSize = null) : base(surface, font, fontSize) { Controls = new ControlHost(); SadComponents.Add(Controls); }
/// <summary> /// Creates a console with the specified width and height, with <see cref="SadRogue.Primitives.Color.Transparent"/> for the background and <see cref="SadRogue.Primitives.Color.White"/> for the foreground. /// </summary> /// <param name="width">The width of the console in cells.</param> /// <param name="height">The height of the console in cells.</param> /// <param name="bufferWidth">The total width of the console in cells.</param> /// <param name="bufferHeight">The total height of the console in cells.</param> /// <param name="initialCells">The cells to seed the console with. If <see langword="null"/>, creates the cells for you.</param> public ControlsConsole(int width, int height, int bufferWidth, int bufferHeight, ColoredGlyph[] initialCells) : base(width, height, bufferWidth, bufferHeight, initialCells) { Controls = new ControlHost(); SadComponents.Add(Controls); }
public SplashScreen() : base(80, 23) { Cursor.IsEnabled = false; IsVisible = false; // Setup the console text background pattern, which is hidden via colors // Print the text template on all of the console surface const string textTemplate = "sole SadCon"; var text = new System.Text.StringBuilder(Width * Height); for (int i = 0; i < Width * Height; i++) { text.Append(textTemplate); } this.Print(0, 0, text.ToString(), Color.Black, Color.Transparent); using ITexture sadImage = GameHost.Instance.GetTexture("Res/Images/sad.png"); var defaultFontSize = SadConsole.Game.Instance.DefaultFont.GetFontSize(SadConsole.Game.Instance.DefaultFontSize); var defaultFontSizeRatio = SadConsole.Game.Instance.DefaultFont.GetGlyphRatio(defaultFontSize); // Load the logo and convert to a console ICellSurface logo;// = sadImage.ToSurface(TextureConvertMode.Background, sadImage.Width / (int)(defaultFontSize.X * defaultFontSizeRatio.Y), sadImage.Height / (int)(defaultFontSize.Y * defaultFontSizeRatio.X)); if (defaultFontSizeRatio.X == 0 && defaultFontSizeRatio.Y == 0) { logo = sadImage.ToSurface(TextureConvertMode.Foreground, Width, Height - 1, foregroundStyle: TextureConvertForegroundStyle.Block); } else if (defaultFontSizeRatio.Y > defaultFontSizeRatio.X) { logo = sadImage.ToSurface(TextureConvertMode.Foreground, (int)((Height - 1) * defaultFontSizeRatio.Y), Height - 1, foregroundStyle: TextureConvertForegroundStyle.Block); } else { logo = sadImage.ToSurface(TextureConvertMode.Foreground, Width, (int)(Width * defaultFontSize.X), foregroundStyle: TextureConvertForegroundStyle.Block); } _consoleImage = new Console(logo); _consoleImage.Position = _consoleImagePosition = new Point(Width / 2 - _consoleImage.Width / 2, 0); _consoleImage.Tint = Color.Black; // Animation for the logo text. var logoText = new ColorGradient(new[] { Color.Magenta, Color.Yellow }, new[] { 0.0f, 1f }) .ToColoredString("[| Powered by SadConsole |]"); logoText.SetEffect(new Fade() { DestinationForeground = Color.Blue, FadeForeground = true, FadeDuration = 1f, Repeat = false, RemoveOnFinished = true, CloneOnAdd = true }); // Configure the animation InstructionSet animation = new InstructionSet() .Wait(TimeSpan.FromSeconds(0.3d)) // Animation to move the angled gradient spotlight effect .Code(MoveGradient) // Clear the background text so new printing doesn't look bad .Code((host, delta) => { ((IScreenSurface)host).Surface.Fill(Color.Black, Color.Transparent, 0); return(true); }) // Draw the SadConsole text at the bottom .Instruct(new DrawString(logoText) { Position = new Point(26, Height - 1), TotalTimeToPrint = 1f }) // Add the logo to the console children .Code((o, delta) => { Children.Add(_consoleImage); return(true); }) // Fade in the logo .Instruct(new FadeTextSurfaceTint(_consoleImage, new ColorGradient(Color.Black, Color.Transparent), TimeSpan.FromSeconds(2))) // Blink SadConsole text at the bottom .Code(SetBlinkOnLogoText) // Delay so blinking effect is seen .Wait(TimeSpan.FromSeconds(2.5d)) // Fade out main console and logo console. .InstructConcurrent(new FadeTextSurfaceTint(_consoleImage, new ColorGradient(Color.Transparent, Color.Black), TimeSpan.FromSeconds(2)), new FadeTextSurfaceTint(this, new ColorGradient(Color.Transparent, Color.Black), TimeSpan.FromSeconds(1.0d))) // Animation has completed, call the callback this console uses to indicate it's complete .Code((host, delta) => { SplashCompleted?.Invoke(); return(true); }) ; animation.RemoveOnFinished = true; SadComponents.Add(animation); }