User Tools

Site Tools


Sidebar

Nebol Software Projects:

.NET Class Libraries

Contact info:

johan@nebol.se

nebolconsole

This is an old revision of the document!


NebolConsole

<documentation not yet available>

An example of a setup with a large output area and a small input area at the bottom:

static void SetupConsole()
{
	const int Width = 80;
	const int Height = 50;
 
	NebolConsole.Console.Instance.SetWindowSize(Width, Height);
 
	var output = new ConsoleArea("output", 1, 1, Width - 2, Height - 4);
	NebolConsole.Console.Instance.Areas.Add(output);
 
	var input = new ConsoleArea("input", 1, Height - 2, Width - 2, 1);
	NebolConsole.Console.Instance.Areas.Add(input);
 
	// add the main area last
	var main = new ConsoleArea("main", 0, 0, Width, Height);
	NebolConsole.Console.Instance.Areas.Add(main);
 
	// add borders, they are drawn on the main area in this case
	// so they are not actually part of their own areas but around them 
	foreach (var carea in NebolConsole.Console.Instance.Areas.Where(item => item != main))
	{
		main.WriteBorder(carea, ConsoleArea.BorderStyle.SIMPLE);
		carea.Wrap = true;
		carea.Scroll = true;
	}
 
	NebolConsole.Console.Instance.OnKeyPressed += OnKeyPressed;
	NebolConsole.Console.Instance.OnStringEntered += OnStringEntered;
 
	input.SetCursorPosition();
 
	NebolConsole.Console.Instance.Update();
}
nebolconsole.1636026165.txt.gz · Last modified: 2021/11/04 12:42 by nebol