using Mindmagma.Curses; namespace SCI.CursesWrapper; public class CursesWrapper { /// /// Initializes NCurses and creates a screen /// public static nint InitNCurses () { var screen = NCurses.InitScreen (); NCurses.SetCursor (0); NCurses.UseDefaultColors (); NCurses.NoEcho (); NCurses.Raw (); NCurses.Keypad (screen, true); NCurses.NoDelay (screen, false); if (NCurses.HasColors ()) { NCurses.StartColor (); ColorSchemes.InitAll (); } return screen; } /// /// Get the total width of a window/screen /// /// Window to query /// Width of window in columns public static int GetWidth (nint window) { NCurses.GetMaxYX (window, out int _, out int width); return width; } /// /// Get the total height of a window /// /// Window to query /// Height of window in rows public static int GetHeight (nint window) { NCurses.GetMaxYX (window, out int height, out int _); return height; } /// /// Compares a key code to a character to test for a held /// Control key during the key press event /// /// /// /// public static bool KeyPressIsCtrl (int keyCode, int testChar) { return keyCode == (testChar & 0x1f); } }