User Tools

Site Tools


nebolconsole

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
nebolconsole [2021/11/04 12:28] nebolnebolconsole [2021/11/04 12:45] (current) nebol
Line 22: Line 22:
  NebolConsole.Console.Instance.Areas.Add(main);  NebolConsole.Console.Instance.Areas.Add(main);
  
- // add borders, they are drawn on the main area + // 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 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))  foreach (var carea in NebolConsole.Console.Instance.Areas.Where(item => item != main))
  {  {
Line 34: Line 34:
  NebolConsole.Console.Instance.OnStringEntered += OnStringEntered;  NebolConsole.Console.Instance.OnStringEntered += OnStringEntered;
  
 + input.SetCursorPosition();
 +
 + NebolConsole.Console.Instance.Update();
 +}
 +</code>
 +
 +
 +<code csharp>
 +protected static void OnStringEntered(object sender, ConsoleStringEnteredEventArgs ea)
 +{
 + var area = NebolConsole.Console.Instance.GetArea("input");
 + area.WriteLine("You typed: " + ea.String);
 +}
 +
 +protected static void OnKeyPressed(object sender, ConsoleKeyPressedEventArgs ea)
 +{
 + var area = NebolConsole.Console.Instance.GetArea("input");
 + area.Write(ea.Key.KeyChar.ToString());
 +
 + area.SetCursorPosition();
 + NebolConsole.Console.Instance.Update();
 +}
 +</code>
 +
 +<code csharp>
 +do
 +{
  NebolConsole.Console.Instance.Update();  NebolConsole.Console.Instance.Update();
 + Thread.Sleep(1000);
 } }
 +while (!shutdown);
 </code> </code>
  
nebolconsole.1636025337.txt.gz · Last modified: 2021/11/04 12:28 by nebol