You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
41 lines
1.0 KiB
41 lines
1.0 KiB
using Mindmagma.Curses;
|
|
|
|
namespace SCI.CursesWrapper;
|
|
|
|
public class CursesWrapper {
|
|
/// <summary>
|
|
/// Initializes NCurses and creates a screen
|
|
/// </summary>
|
|
public static nint InitNCurses () {
|
|
var screen = NCurses.InitScreen ();
|
|
NCurses.SetCursor (0);
|
|
NCurses.NoEcho ();
|
|
|
|
if (NCurses.HasColors ()) {
|
|
NCurses.StartColor ();
|
|
ColorSchemes.InitAll ();
|
|
}
|
|
|
|
return screen;
|
|
}
|
|
|
|
/// <summary>
|
|
/// Get the total width of a window
|
|
/// </summary>
|
|
/// <param name="window">Window to query</param>
|
|
/// <returns>Width of window in columns</returns>
|
|
public static int GetWidth (nint window) {
|
|
NCurses.GetMaxYX (window, out int _, out int width);
|
|
return width;
|
|
}
|
|
|
|
/// <summary>
|
|
/// Get the total height of a window
|
|
/// </summary>
|
|
/// <param name="window">Window to query</param>
|
|
/// <returns>Height of window in rows</returns>
|
|
public static int GetHeight (nint window) {
|
|
NCurses.GetMaxYX (window, out int height, out int _);
|
|
return height;
|
|
}
|
|
} |