Nice output

This commit is contained in:
glax 2023-11-29 02:13:12 +01:00
parent d9b3368cb2
commit e99974e754

View File

@ -20,7 +20,7 @@ public class OSCCollar
private uint _nilSent = 0; private uint _nilSent = 0;
private DateTime _lastNilMessageSent = DateTime.UnixEpoch; private DateTime _lastNilMessageSent = DateTime.UnixEpoch;
private DateTime _lastConsoleOutput = DateTime.UnixEpoch; private DateTime _lastConsoleOutput = DateTime.UnixEpoch;
private static readonly TimeSpan ConsoleUpdateInterval = TimeSpan.FromMilliseconds(50); private static readonly TimeSpan ConsoleUpdateInterval = TimeSpan.FromMilliseconds(100);
private static readonly TimeSpan UpdateFieldsTimeout = TimeSpan.FromMilliseconds(1); private static readonly TimeSpan UpdateFieldsTimeout = TimeSpan.FromMilliseconds(1);
private static readonly TimeSpan NilMessageMaxTimeout = TimeSpan.FromMilliseconds(400); private static readonly TimeSpan NilMessageMaxTimeout = TimeSpan.FromMilliseconds(400);
@ -50,14 +50,29 @@ public class OSCCollar
Console.WriteLine($"Stretch:.............{_collarStretch:0.0000}"); Console.WriteLine($"Stretch:.............{_collarStretch:0.0000}");
Console.WriteLine($"Vertical Movement:...{verticalMovement:0.0000}"); Console.WriteLine($"Vertical Movement:...{verticalMovement:0.0000}");
Console.WriteLine($"Horizontal Movement:.{horizontalMovement:0.0000}"); Console.WriteLine($"Horizontal Movement:.{horizontalMovement:0.0000}");
Console.WriteLine(""); Console.SetCursorPosition(0, Console.WindowHeight - 2);
Console.WriteLine(""); Console.Write($"/input nil sent {_nilSent}");
Console.WriteLine("");
Console.WriteLine(""); Console.SetCursorPosition(28, 8);
Console.WriteLine(""); Console.WriteLine("----------+----------");
Console.WriteLine(""); for (int i = 4; i < 13; i++)
Console.WriteLine(""); {
Console.WriteLine($"Sending /input nil {_nilSent}"); if(i == 8)
continue;
Console.SetCursorPosition(38,i);
Console.Write("|");
}
int centerX = 38;
int centerY = 8;
int consoleX = Convert.ToInt32(Math.Floor(_horizontalMovement * 10));
int consoleY = Convert.ToInt32(-Math.Floor(_verticalMovement * 5));
double position = (_verticalMovement * 100) % 10;
char c = position < 3 ? '.' : position > 7 ? '\'' : 'x';
Console.SetCursorPosition(centerX + consoleX, centerY + consoleY);
Console.ForegroundColor = ConsoleColor.Cyan;
Console.Write(c);
Console.SetCursorPosition(Console.WindowWidth - 1, Console.WindowHeight - 1);
} }
private void AllowMovingHandle(OscMessageValues messageValues) private void AllowMovingHandle(OscMessageValues messageValues)