using Brutal.Pointers; namespace Brutal.NotCursesApi; /// /// Hand-written ergonomics for the notcurses fullscreen-mode handle. Most methods on this handle /// are auto-generated by Brutal.NotCurses.Generate (see Generated/Wrappers.gen.cs); /// only the things the generator can't infer (static factories, the IDisposable contract) live here. /// public readonly unsafe partial struct NotCursesHandle : IDisposable { /// /// Initializes notcurses in fullscreen mode, writing to stdout. Throws if the terminal /// is incompatible. Dispose (or call ) to restore the terminal. /// public static NotCursesHandle Init(NotCursesOptions options = default) { var nc = NotCurses.PInvoke.notcurses_core_init(new Ptr(&options), default); if (nc.IsNull()) throw new InvalidOperationException( "notcurses_core_init failed (terminal incompatible or already in fullscreen mode)." ); return nc; } /// Restores the terminal and tears down notcurses state. Calls . public void Dispose() => Stop(); /// /// Blits to a fresh child plane and returns that plane. Auto-generation /// skipped this one because its C name (ncvisual_blit) doesn't carry the notcurses_ /// owner prefix even though it takes a notcurses handle first. /// public NcPlaneHandle Blit(NcVisualHandle visual, NcVisualOptions options = default) => NotCurses.PInvoke.ncvisual_blit(this, visual, new Ptr(&options)); }