mirror of
https://github.com/ahwootech/BRUTAL.git
synced 2026-11-25 12:38:24 +01:00
samples: add Hello/Demo samples for most BRUTAL packages
Add samples/, a collection of single-file .NET 10 apps run with `dotnet run <file>.cs`. Hello/ has one minimal sample per package that has a public API, many of them headless; Demo/ has fuller programs that combine packages into a more interesting application. samples/README.md indexes every sample and covers the layout, error handling and per-OS requirements.
This commit is contained in:
parent
a25cdf80b2
commit
b0c9fd9cdc
1 changed files with 4599 additions and 1 deletions
29
samples/Hello/HelloNotCurses.cs
Normal file
29
samples/Hello/HelloNotCurses.cs
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
/*
|
||||
* HelloNotCurses
|
||||
*
|
||||
* Draws coloured text with notcurses and waits for a key. Run it in a real terminal.
|
||||
*/
|
||||
|
||||
#:package Ahwoo.Brutal.NotCurses@2026.10.0
|
||||
#:package Ahwoo.Brutal.Numerics@2026.10.1
|
||||
|
||||
// RIAN: I'm the only one who uses this for tooling, please don't use it in your server applications.
|
||||
|
||||
using Brutal.NotCursesApi;
|
||||
using Brutal.Numerics;
|
||||
|
||||
Run();
|
||||
|
||||
static void Run()
|
||||
{
|
||||
using var nc = NotCursesHandle.Init(); // Takes over the terminal until disposed.
|
||||
|
||||
var plane = nc.StdPlane();
|
||||
plane.SetFgRgb(0x66DD55);
|
||||
plane.PutStr(new int2(2, 1), $"Hello from notcurses {NotCurses.Version}!");
|
||||
plane.SetFgRgb(0xFFFFFF);
|
||||
plane.PutStr(new int2(2, 3), "Press any key to exit.");
|
||||
nc.Render();
|
||||
|
||||
nc.GetBlocking(out _);
|
||||
}
|
||||
Loading…
Reference in a new issue