渲染优化
This commit is contained in:
parent
6a261ecae7
commit
49b462253a
|
@ -170,6 +170,7 @@ public class Music
|
||||||
var a = chars.GetLength(0);
|
var a = chars.GetLength(0);
|
||||||
var b = chars.GetLength(1);
|
var b = chars.GetLength(1);
|
||||||
var buffer = new StringBuilder();
|
var buffer = new StringBuilder();
|
||||||
|
ConsoleColor xiantiaoColor = random.Next(0, 2) == 0 ? ConsoleColor.Red : ConsoleColor.Blue;//线条的颜色
|
||||||
while (IsWhile)
|
while (IsWhile)
|
||||||
{
|
{
|
||||||
stopwatch.Restart();
|
stopwatch.Restart();
|
||||||
|
@ -180,7 +181,7 @@ public class Music
|
||||||
{
|
{
|
||||||
for (j = 0; j < b; j++)
|
for (j = 0; j < b; j++)
|
||||||
{
|
{
|
||||||
Console.ForegroundColor = chars[i, j].Color;
|
//Console.ForegroundColor = chars[i, j].Color;
|
||||||
//Console.Write($" {chars[i, j].Char} ");
|
//Console.Write($" {chars[i, j].Char} ");
|
||||||
buffer.Append(chars[i, j].Char);
|
buffer.Append(chars[i, j].Char);
|
||||||
time++;
|
time++;
|
||||||
|
@ -192,13 +193,14 @@ public class Music
|
||||||
buffer.AppendLine();
|
buffer.AppendLine();
|
||||||
//Console.WriteLine();
|
//Console.WriteLine();
|
||||||
}
|
}
|
||||||
|
Console.ForegroundColor = ConsoleColor.DarkBlue;
|
||||||
Console.Write(buffer.ToString());
|
Console.Write(buffer.ToString());
|
||||||
if (time % 1000 == 0)
|
if (time % 1000 == 0)
|
||||||
{
|
{
|
||||||
Console.ForegroundColor = random.Next(0, 2) == 0 ? ConsoleColor.Red : ConsoleColor.Blue;
|
xiantiaoColor= random.Next(0, 2) == 0 ? ConsoleColor.Red : ConsoleColor.Blue;
|
||||||
}
|
}
|
||||||
// Console.ForegroundColor = (ConsoleColor)random.Next(0, 16);
|
// Console.ForegroundColor = (ConsoleColor)random.Next(0, 16);
|
||||||
|
Console.ForegroundColor = xiantiaoColor;
|
||||||
for (i = 0; i < b; i++)
|
for (i = 0; i < b; i++)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
@ -218,8 +220,8 @@ public class Music
|
||||||
// 保持每秒约16.67ms(即大约60 FPS)的间隔
|
// 保持每秒约16.67ms(即大约60 FPS)的间隔
|
||||||
// Thread.Sleep(Math.Max(0, 60 - (int)elapsedMilliseconds));
|
// Thread.Sleep(Math.Max(0, 60 - (int)elapsedMilliseconds));
|
||||||
|
|
||||||
//死方法 不知道为什么 控制台限制60 帧这样闪烁不会太严重
|
//这样闪烁不会太严重
|
||||||
Thread.Sleep(150);
|
Thread.Sleep(100);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
private void setCharArry()
|
private void setCharArry()
|
||||||
|
|
Loading…
Reference in New Issue
Block a user