private static bool InitializeNCurses(ref IntPtr screen, short[] colorMap, Byte width, Byte height) { screen = NCurses.InitScreen(); if (NCurses.HasColors() == false) { Console.WriteLine("Your terminal doesn't support colored output."); NCurses.EndWin(); return(false); } if ((NCurses.Columns < width - 1) || (NCurses.Lines < height - 1)) { Console.WriteLine($"Your terminal must be {width}x{height}. You have {NCurses.Columns}x{NCurses.Lines}"); NCurses.EndWin(); return(false); } NCurses.NoDelay(screen, true); NCurses.NoEcho(); NCurses.AttributeSet(CursesAttribute.NORMAL); NCurses.StartColor(); NCurses.InitPair(colorMap[0], CursesColor.BLACK, CursesColor.BLACK); NCurses.InitPair(colorMap[1], CursesColor.WHITE, CursesColor.WHITE); return(true); }
static void Main(string[] args) { Screen = NCurses.InitScreen(); try { Mouse(); } finally { NCurses.EndWin(); } }
public Game(Size size, int baseSnakeSize = 4) { this.size = size; random = new Random(); snake = new Snake(new Point(size.Height / 2, size.Width / 2), baseSnakeSize); GenerateNewApple(); PlayerScore = 0; isGameOver = false; screen = NCurses.InitScreen(); NCurses.NoEcho(); }
/// <summary> /// Select the routine and initialize it. /// </summary> public static void Init() { // Initialize NCurses _window = NCurses.InitScreen(); NCurses.CBreak(); NCurses.NoEcho(); NCurses.Keypad(_window, true); // Pick routine, and generate its map and views _routine = PickRoutine(); _routine.GenerateMap(); _routine.CreateViews(); // Set up viewport, defaulting to first item in views list _mapView = new RoutineViewport(_routine, Console.WindowWidth - 1, Console.WindowHeight - 1); }
public void Init() { Screen = NCurses.InitScreen(); }