SadConsole 10.0.0-alpha3

This is a prerelease version of SadConsole.
There is a newer version of this package available.
See the version list below for details.
dotnet add package SadConsole --version 10.0.0-alpha3                
NuGet\Install-Package SadConsole -Version 10.0.0-alpha3                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="SadConsole" Version="10.0.0-alpha3" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add SadConsole --version 10.0.0-alpha3                
#r "nuget: SadConsole, 10.0.0-alpha3"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install SadConsole as a Cake Addin
#addin nuget:?package=SadConsole&version=10.0.0-alpha3&prerelease

// Install SadConsole as a Cake Tool
#tool nuget:?package=SadConsole&version=10.0.0-alpha3&prerelease                

SadConsole Logo

Chat on discord NuGet kandi X-Ray

SadConsole is a generic library that emulates old-school console game systems. It provides command prompt-style graphics where one or more tile textures are used to represent an ASCII character set. Console's are made up of a grid of cells, each of which can have its own foreground, background, glyph, and special effect applied to it.

While SadConsole is a generic library that doesn't provide any rendering capabilities, "host" libraries are provided that add renderers to SadConsole. The two hosts provided by this library are for MonoGame and SFML.

SadConsole currently targets .NET 6 and .NET 7

For the latest changes in this release, see the notes below

Features

Here are some of the features SadConsole supports:

  • Show any number of consoles.
  • Uses graphical tile-based images to build out an ASCII-character font with support for more than 256 characters.
  • Use more than one font file. However, each console is restricted to a single font.
  • Independently controlled entities for game objects.
  • Keyboard and Mouse support.
  • Text UI control framework with windowing support.
  • Importers for DOS ANSI files, TheDraw text fonts, RexPaint, and Playscii.
  • Animated consoles.
  • Translating images to text-blocks.
  • Highly customizable framework.
String display and parsing

string pic

GUI library

GUI library pic

Scrolling

scrolling console

Dependencies

SadConsole uses NuGet for its .NET dependencies:

Example startup code

using SadConsole;

Settings.WindowTitle = "SadConsole Examples";

Game.Configuration gameStartup = new Game.Configuration()
    .SetScreenSize(90, 30)
    .OnStart(onStart)
    .IsStartingScreenFocused(false)
    .ConfigureFonts((f) => f.UseBuiltinFontExtended())
    ;

Game.Create(gameStartup);
Game.Instance.Run();
Game.Instance.Dispose();

void onStart()
{
    ColoredGlyph boxBorder = new ColoredGlyph(Color.White, Color.Black, 178);
    ColoredGlyph boxFill = new ColoredGlyph(Color.White, Color.Black);

    Game.Instance.StartingConsole.FillWithRandomGarbage(255);
    Game.Instance.StartingConsole.DrawBox(new Rectangle(2, 2, 26, 5), ShapeParameters.CreateFilled(boxBorder, boxFill));
    Game.Instance.StartingConsole.Print(4, 4, "Welcome to SadConsole!");
}

Latest changes v10.0.0 Alpha 3 (XX/XX/2023)

Major changes (possibly breaking)

  • [Core] The editor functions that changed glyphs and printed on consoles have moved from being extension methods for the ICellSurface interface to the ISurface interface. Console, IScreenSurface, and ICellSurface, all implement this new interface. This means you can now use the editing extensions directly on those objects.
  • [Core] Because Console no longer implements ICellSurface, and instead implements ISurface, some properties have been moved to the Surface property, such as myConsole.TimesShiftedUp is now myConsole.Surface.TimesShiftedUp.
  • [Core] Themes have been removed. Each control draws itself.
  • [Core] IScreenObject no longer implements IEnumerable to access the children. Use the .Children collection property instead.
  • [Core] Update and Render no longer check for IsEnabled and IsVisible, respectively. When those methods run, the properties are checked on the children before calling the respective method. This moves the check outside of the object itself, and relies on the parent object to do it. This eliminates the need for an object to check itself, and allows you to bypass the check when you want.

New features

  • [Core] Added Componenets.LayeredSurface component. Add this component to a ScreenSurface to enable multiple surface layers. Use the LayeredSurface to manage the layers.
  • [UI] New control, NumberBox. The IsNumeric system was removed from the TextBox and put into its own control.
  • [UI] New control, TabControl. Contributed by arxae.
  • [ExtendedLib.UI] New control, Table. Contributed by Ven0maus.

Normal changes

  • Target .NET 6+ exclusively. Core library is nullable aware.
  • [Core] Splash screen printing wasn't being shown because of cursor changes.
  • [Core] IFont now defines glyph definitions.
  • [Core] Various SadFont properties and methods are now settable/callable.
  • [Core] Extensions methods added to hosts to allow manipulation of font textures.
  • [Core] Settings.CreateStartingConsole setting added to avoid creating the StartingConsole.
  • [Core] Cursor now has the property DisablePrintAutomaticLineFeed which, when true, prevents the cursor from moving to the next line if printing a character at the end of the current line.
  • [Core] Ansi.AnsiWriter handles sauce now by ignoring the rest of a document once character 26 (CTRL-Z) is encountered.
  • [Core] Ansi.AnsiWriter has always used a cursor to print, it now sets UseLinuxLineEndings = true and DisablePrintAutomaticLineFeed = true.
  • [Core] Added SadConsole.SplashScreens.Ansi1 splashscreen, the new SadConsole logo, for use with games.
  • [Core] Added ScreenSurface.QuietSurfaceHandling property. When true, this property prevents the .Surface property from raising events and calling virtual methods when the instance changes. This is useful for AnimatedScreenSurface instances that have fast moving animations.
  • [Core] Entities.Renderer renamed Entities.EntityRenderer.
  • [Core] The Entity type now supports animated surfaces. When creating an entity, you must specify it as a single cell entity or animated surface entity.
  • [Core] The effects system had a bug where if you added the same effect with the same cell twice, and the effect should restore the cell state, it wouldn't.
  • [Core] AsciiKey used by the keyboard system now detects capslock and shifted state to produce capital or lowercase letters.
  • [Core] AsciiKey exposes a bunch of static dictionaries that help with remapping keys and characters.
  • [Core] ColoredGlyph.IsVisible now sets ColoredGlyph.IsDirty to true when its value changes.
  • [Core] Surface.RenderSteps moved to the renderer.
  • [Core] RenderSteps is now a List and you must call RenderSteps.Sort(SadConsole.Renderers.RenderStepComparer.Instance) when the collection is changed.
  • [Core] Instructions.DrawString uses System.TimeSpan now, and is more accurate.
  • [Core] Effects have a RunEffectOnApply property that will run the effect.Update method once, with a duration of zero, when the effect is added to a manager.
  • [Core] EffectsManager will apply the active effect to a cell right when the cell is added to the effect. This was happening on the next render frame.
  • [Core] Surface shifting is much more performant (Thanks Chris3606)
  • [Core] Cursor has some new methods for erasing: Erase, EraseUp, EraseDown, EraseLeft, EraseRight, EraseColumn, EraseRow.
  • [Core] Mouse state object now tracks *ButtonDownDuration times. When the button is down and the time is zero, this indicates the button was just pressed. Otherwise, you can detect how long the button has been held down.
  • [Core] Rename RexPaint ToLayersComponent to ToCellSurface.
  • [Core] Rework Timer with Start/Stop/Restart methods.
  • [UI] Scroll bar with a size of 3 now disables the middle area, and you can use a size of 2 now.
  • [UI] Scroll bar supports a thickness other than 1.
  • [UI] Control host would get stuck when tabbing to a control that was disabled. Now it skips the control.
  • [UI] TextBox rewritten. The IsNumeric system was removed and added to a new control: NumberBox. The TextBox no longer has an editing mode and simply starts editing as it's focused and stops editing once it loses focus.
  • [UI] ControlBase.IsDirty property now calls the protected OnIsDirtyChanged method which then raises the IsDirtyChanged event.
  • [UI] Panel control uses CompositeControl as a base class. Control can draw a border.
  • [UI] ProgressBar is easier to customize.
  • [ExtendedLib] Border control uses view size now instead of full size of wrapping object.
  • [ExtendedLib] Border.AddToSurface/Window has been renamed to Border.CreateForSurface/Window.
  • [ExtendedLib] Entities.EntityManager renamed Entities.EntityManagerZoned.

Removed

  • [Core] Algorithms.Line\Circle\Ellipse have been removed. The latest primitives library provides these methods.
  • [Core] Shapes namespace removed. The latest primitives library release that SadConsole uses, provides these.

Host changes

  • [MonoGame] NuGet package has a -windows framework target that targets DirectX and adds support for WPF.
  • [MonoGame] Fix conversion of Mirror to SpriteEffects.
  • [MonoGame\SFML] Surface renderers now skip the glyph if the glyph is 0.
  • [MonoGame\SFML] New SurfaceDirtyCells renderer added which only draws cells that are marked dirty.
  • [MonoGame\SFML] New Game.Configuration object used for creating a SadConsole game.
Product Compatible and additional computed target framework versions.
.NET net6.0 is compatible.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 is compatible.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (7)

Showing the top 5 NuGet packages that depend on SadConsole:

Package Downloads
SadConsole.Extended

A library of common classes that extend SadConsole with new controls, windows, and more.

SadConsole.Host.MonoGame

A graphics hosting library for SadConsole that targets MonoGame.

SadConsole.Host.SFML

A graphics hosting library for SadConsole that targets SFML.

SadConsole.GoRogueHelpers

A helper library for SadConsole games built with GoRogue.

TheSadRogue.Integration

An official integration library for using GoRogue and SadConsole together to create a roguelike.

GitHub repositories (1)

Showing the top 1 popular GitHub repositories that depend on SadConsole:

Repository Stars
Thraka/SadConsole
A .NET ascii/ansi console engine written in C# for MonoGame and XNA. Create your own text roguelike (or other) games!
Version Downloads Last updated
10.4.2 165 10/24/2024
10.4.2-debug 62 10/24/2024
10.4.1 1,102 6/13/2024
10.4.1-debug 144 6/13/2024
10.4.0 1,190 3/31/2024
10.4.0-debug 198 3/31/2024
10.0.3 456 3/14/2024
10.0.3-debug 253 3/14/2024
10.0.2 1,559 11/10/2023
10.0.2-debug 871 11/10/2023
10.0.1 746 11/10/2023
10.0.1-debug 716 11/10/2023
10.0.0 1,782 10/29/2023
10.0.0-debug 983 10/29/2023
10.0.0-beta3-debug 1,096 10/14/2023
10.0.0-beta3 1,062 10/14/2023
10.0.0-beta2-debug 1,045 10/11/2023
10.0.0-beta2 1,066 10/11/2023
10.0.0-beta1-debug 1,073 10/11/2023
10.0.0-beta1 1,112 10/11/2023
10.0.0-alpha4-debug 1,363 8/26/2023
10.0.0-alpha4 1,296 8/26/2023
10.0.0-alpha3-debug 1,207 8/26/2023
10.0.0-alpha3 1,224 8/26/2023
10.0.0-alpha2-debug 1,591 6/18/2023
10.0.0-alpha2 1,387 6/18/2023
10.0.0-alpha1-debug 1,487 6/4/2023
9.2.2 5,046 1/22/2022
9.2.2-debug 1,184 1/22/2022
9.2.1 2,442 1/4/2022
9.2.0 3,306 12/31/2021
9.2.0-debug 1,076 12/31/2021
9.1.1 5,391 8/7/2021
9.1.1-debug 1,267 8/7/2021
9.1.0 2,129 7/6/2021
9.1.0-debug 1,253 7/6/2021
9.0.0 4,622 6/6/2021
9.0.0-debug 1,239 6/6/2021
9.0.0-beta4 1,943 1/15/2021
9.0.0-beta3 2,051 12/19/2020
9.0.0-beta2 1,569 10/9/2020
9.0.0-beta1 1,692 8/1/2020
9.0.0-alpha9 1,703 7/25/2020
9.0.0-alpha8 1,393 7/13/2020
9.0.0-alpha7 1,731 7/11/2020
9.0.0-alpha6 1,746 5/28/2020
9.0.0-alpha5 1,559 5/26/2020
9.0.0-alpha4 1,405 5/1/2020
9.0.0-alpha3 1,601 5/1/2020
9.0.0-alpha2 1,494 3/14/2020
9.0.0-alpha1 1,914 1/26/2020
8.99.3 3,694 8/15/2020
8.99.3-debug 1,447 8/15/2020
8.99.2 1,771 7/14/2020
8.99.2-debug 1,407 7/14/2020
8.99.1 2,420 4/11/2020
8.99.1-debug 1,408 4/11/2020
8.99.0 2,455 11/27/2019
8.99.0-debug 1,402 11/27/2019
8.9.1 3,821 11/5/2019
8.9.1-debug 1,411 11/5/2019
8.9.0 2,170 9/7/2019 8.9.0 is deprecated because it is no longer maintained.
8.9.0-debug 1,596 9/7/2019 8.9.0-debug is deprecated because it is no longer maintained.
8.8.1 3,034 7/28/2019 8.8.1 is deprecated because it is no longer maintained.
8.8.1-debug 1,574 7/28/2019 8.8.1-debug is deprecated because it is no longer maintained.
8.8.0 2,351 7/27/2019 8.8.0 is deprecated because it is no longer maintained.
8.8.0-debug 1,514 7/27/2019 8.8.0-debug is deprecated because it is no longer maintained.
8.7.1 1,906 6/22/2019 8.7.1 is deprecated because it is no longer maintained.
8.7.1-debug 1,576 6/22/2019 8.7.1-debug is deprecated because it is no longer maintained.
8.7.0 1,755 6/22/2019 8.7.0 is deprecated because it is no longer maintained.
8.7.0-debug 1,595 6/22/2019 8.7.0-debug is deprecated because it is no longer maintained.
8.6.0 2,034 4/14/2019 8.6.0 is deprecated because it is no longer maintained.
8.6.0-debug 1,601 4/14/2019 8.6.0-debug is deprecated because it is no longer maintained.
8.5.0 1,928 4/2/2019 8.5.0 is deprecated because it is no longer maintained.
8.5.0-debug 1,623 4/2/2019 8.5.0-debug is deprecated because it is no longer maintained.
8.4.1 1,882 3/19/2019 8.4.1 is deprecated because it is no longer maintained.
8.4.1-debug 1,662 3/19/2019 8.4.1-debug is deprecated because it is no longer maintained.
8.4.0 1,749 3/17/2019 8.4.0 is deprecated because it is no longer maintained.
8.4.0-debug 1,595 3/17/2019 8.4.0-debug is deprecated because it is no longer maintained.
8.3.0 1,855 3/10/2019 8.3.0 is deprecated because it is no longer maintained.
8.3.0-debug 1,586 3/10/2019 8.3.0-debug is deprecated because it is no longer maintained.
8.2.0 1,892 3/2/2019 8.2.0 is deprecated because it is no longer maintained.
8.2.0-debug 1,666 3/2/2019 8.2.0-debug is deprecated because it is no longer maintained.
8.1.0 1,851 2/28/2019 8.1.0 is deprecated because it is no longer maintained.
8.1.0-debug 1,586 2/28/2019 8.1.0-debug is deprecated because it is no longer maintained.
8.0.0 1,949 2/24/2019 8.0.0 is deprecated because it is no longer maintained.
8.0.0-pre5 1,636 2/19/2019 8.0.0-pre5 is deprecated because it is no longer maintained.
8.0.0-pre4 1,667 1/31/2019 8.0.0-pre4 is deprecated because it is no longer maintained.
8.0.0-pre2 1,717 12/30/2018 8.0.0-pre2 is deprecated because it is no longer maintained.
8.0.0-pre1 1,684 12/30/2018 8.0.0-pre1 is deprecated because it is no longer maintained.
7.3.0 2,011 12/29/2018
7.2.0 2,103 11/20/2018 7.2.0 is deprecated because it is no longer maintained.
7.1.0 2,136 10/19/2018 7.1.0 is deprecated because it is no longer maintained.
7.0.4 2,083 9/8/2018 7.0.4 is deprecated because it is no longer maintained.
7.0.3 1,944 9/8/2018 7.0.3 is deprecated because it is no longer maintained.
7.0.2 2,300 8/31/2018 7.0.2 is deprecated because it is no longer maintained.
7.0.0 2,063 8/29/2018
7.0.0-pre1 1,775 8/22/2018 7.0.0-pre1 is deprecated because it is no longer maintained.
6.5.0 2,253 6/12/2018
6.4.11 2,302 4/13/2018 6.4.11 is deprecated because it is no longer maintained.
6.4.11-pre1 2,096 4/6/2018 6.4.11-pre1 is deprecated because it is no longer maintained.
6.4.10 2,258 3/18/2018 6.4.10 is deprecated because it is no longer maintained.
6.4.9 2,215 3/18/2018 6.4.9 is deprecated because it is no longer maintained.
6.4.8 2,182 3/18/2018 6.4.8 is deprecated because it is no longer maintained.
6.4.7 2,264 3/16/2018 6.4.7 is deprecated because it is no longer maintained.
6.4.6 2,463 2/14/2018 6.4.6 is deprecated because it is no longer maintained.
6.4.5 2,281 2/3/2018 6.4.5 is deprecated because it is no longer maintained.
6.4.3 2,261 11/14/2017 6.4.3 is deprecated because it is no longer maintained.
6.4.2 2,344 8/11/2017 6.4.2 is deprecated because it is no longer maintained.
6.4.1 2,167 8/10/2017 6.4.1 is deprecated because it is no longer maintained.
6.4.0 2,242 7/25/2017 6.4.0 is deprecated because it is no longer maintained.
6.3.0 2,264 6/9/2017 6.3.0 is deprecated because it is no longer maintained.
6.2.2 2,272 5/20/2017 6.2.2 is deprecated because it is no longer maintained.
6.2.1 2,382 4/23/2017 6.2.1 is deprecated because it is no longer maintained.
6.2.0 2,189 4/22/2017 6.2.0 is deprecated because it is no longer maintained.
6.1.4 2,186 4/17/2017 6.1.4 is deprecated because it is no longer maintained.
6.1.3 2,880 4/3/2017 6.1.3 is deprecated because it is no longer maintained.
6.1.2 2,154 4/1/2017 6.1.2 is deprecated because it is no longer maintained.
6.1.1 2,117 4/1/2017 6.1.1 is deprecated because it is no longer maintained.
6.1.0 2,139 3/31/2017 6.1.0 is deprecated because it is no longer maintained.
6.0.1 2,259 3/19/2017 6.0.1 is deprecated because it is no longer maintained.
6.0.0 2,060 3/18/2017

- Themes have been removed. Each control draws itself.
- IScreenObject no longer implements IEnumerable to access the children. Use the .Children collection property instead.
- Update and Render no longer check for IsEnabled and IsVisible, respectively. When those methods run, the properties are checked on the children before calling the respective method. This moves the check outside of the object itself, and relies on the parent object to do it. This eliminates the need for an object to check itself, and allows you to bypass the check when you want.
- Added Table and Tab controls.
- Entities.Renderer renamed Entities.EntityRenderer.