Terminal.ScreenLibrary
0.3.1-beta
dotnet add package Terminal.ScreenLibrary --version 0.3.1-beta
NuGet\Install-Package Terminal.ScreenLibrary -Version 0.3.1-beta
<PackageReference Include="Terminal.ScreenLibrary" Version="0.3.1-beta" />
paket add Terminal.ScreenLibrary --version 0.3.1-beta
#r "nuget: Terminal.ScreenLibrary, 0.3.1-beta"
// Install Terminal.ScreenLibrary as a Cake Addin #addin nuget:?package=Terminal.ScreenLibrary&version=0.3.1-beta&prerelease // Install Terminal.ScreenLibrary as a Cake Tool #tool nuget:?package=Terminal.ScreenLibrary&version=0.3.1-beta&prerelease
Terminal.ScreenLibrary
Introduction
This is a library for creating a terminal screen with a text-based user interface.
The library was originally created to provide a console interface for the ghg-online game, but I believe it can be useful for other projects as well.
Usage
Step 1: Install the library
You can install the NuGet Package with the following command.
dotnet add package Terminal.ScreenLibrary --version 0.2.0-beta
Also, you can add package reference in
your .csproj
file.
<PackageReference Include="Terminal.ScreenLibrary" Version="0.2.0-beta" />
All the classes are in the Terminal.ScreenLibrary
namespace.
using Terminal.ScreenLibrary;
Step 2: Create a screen driver
Terminal.ScreenLibrary is a library for creating a terminal, but it does not provide any display implementation. This gives you great flexibility to choose your own display implementation.
To write a screen driver, the only thing
you need to do is to implement the IScreenDriver
interface.
public interface IScreenDriver
{
int Width { get; }
int Height { get; }
void Redraw();
void Update(int x, int y, char c, Color foreground, Color background);
void UpdateCursor(int x, int y, bool show);
}
As you can see, the interface is very simple.
One thing you need to remember is that Width
and Height
should be constant, since screen
resizing is not supported yet.
Update
method should updates the screen buffer, but it is not needed
to apply the changes when Update
is called.
It is promised that when changes need to be shown,
Redraw()
will be called.
Step 3: Use it as you like!
Now, you can create
a Screen
object and use it as a normal terminal.
var screen = new Screen(myScreenDriver, Color.White, Color.Black);
screen.HandleString("Hello, world!");
The library support some basic color setting escape
strings, such as "\x1b[31m"
. Other escape strings
are not supported, but they can be detected and not shown.
License
The library is licensed under GPLv2, the same as ghg-online project.
Contribution
I believe no one would like to contribute to this project, but if you do, you are welcome to do so. Leave a issue or pull request, and I will check it.
Contact
If you have any questions, you can leave an issue
or contact me via email: nictheboy@outlook.com
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. 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 was computed. 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. |
.NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
.NET Standard | netstandard2.0 is compatible. netstandard2.1 was computed. |
.NET Framework | net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
MonoAndroid | monoandroid was computed. |
MonoMac | monomac was computed. |
MonoTouch | monotouch was computed. |
Tizen | tizen40 was computed. tizen60 was computed. |
Xamarin.iOS | xamarinios was computed. |
Xamarin.Mac | xamarinmac was computed. |
Xamarin.TVOS | xamarintvos was computed. |
Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETStandard 2.0
- No dependencies.
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated |
---|---|---|
0.3.1-beta | 98 | 10/9/2023 |
0.2.3-beta | 83 | 10/9/2023 |
0.2.2-beta | 90 | 10/8/2023 |
0.2.1-beta | 136 | 9/27/2023 |
0.2.0-beta | 67 | 9/27/2023 |
0.1.1-beta | 55 | 9/19/2023 |
0.1.0-beta | 74 | 9/18/2023 |
This is a beta version, and bugs may exist.