Remove DiffDraw.FullDraw (merged with DiffDraw.Draw)
This commit is contained in:
parent
c5fc9874b1
commit
b56fb7db78
|
@ -20,7 +20,7 @@ namespace CLITest
|
||||||
BackColor = ConsoleColor.DarkGreen
|
BackColor = ConsoleColor.DarkGreen
|
||||||
};
|
};
|
||||||
screen.Controls.Add(btn1);
|
screen.Controls.Add(btn1);
|
||||||
btn1.Click += (screen1, eventArgs) => { DiffDraw.FullDraw(true); };
|
btn1.Click += (screen1, eventArgs) => { DiffDraw.Draw(true, true); };
|
||||||
Label lab1 = new Label("Meem")
|
Label lab1 = new Label("Meem")
|
||||||
{
|
{
|
||||||
Point = new Point(2, 1),
|
Point = new Point(2, 1),
|
||||||
|
|
|
@ -76,7 +76,7 @@ namespace CC_Functions.Commandline.TUI
|
||||||
if (!initial)
|
if (!initial)
|
||||||
{
|
{
|
||||||
Console.Clear();
|
Console.Clear();
|
||||||
DiffDraw.FullDraw(Color);
|
DiffDraw.Draw(Color, true);
|
||||||
}
|
}
|
||||||
_resizing = false;
|
_resizing = false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,49 +26,14 @@ namespace CC_Functions.Commandline.TUI
|
||||||
/// Draws to the console
|
/// Draws to the console
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="color">Whether to use color</param>
|
/// <param name="color">Whether to use color</param>
|
||||||
public static void Draw(bool color)
|
/// <param name="full">Whether to redraw the entire screen (should be done from time to time to prevent corruption)</param>
|
||||||
|
public static void Draw(bool color, bool full = false)
|
||||||
{
|
{
|
||||||
Console.CursorTop = 0;
|
Console.CursorTop = 0;
|
||||||
Console.CursorLeft = 0;
|
Console.CursorLeft = 0;
|
||||||
ConsoleColor fCol = Console.ForegroundColor;
|
ConsoleColor fCol = Console.ForegroundColor;
|
||||||
ConsoleColor bCol = Console.BackgroundColor;
|
ConsoleColor bCol = Console.BackgroundColor;
|
||||||
int width = Width;
|
if (full) Console.Clear();
|
||||||
int height = Height;
|
|
||||||
for (int y = 0; y < height; y++)
|
|
||||||
{
|
|
||||||
for (int x = 0; x < width; x++)
|
|
||||||
{
|
|
||||||
Pixel tmp1 = Screen[y, x];
|
|
||||||
if (tmp1 == _last[y, x]) continue;
|
|
||||||
if (color)
|
|
||||||
{
|
|
||||||
if (Console.ForegroundColor != tmp1.ForeColor)
|
|
||||||
Console.ForegroundColor = tmp1.ForeColor;
|
|
||||||
if (Console.BackgroundColor != tmp1.BackColor)
|
|
||||||
Console.BackgroundColor = tmp1.BackColor;
|
|
||||||
}
|
|
||||||
Console.CursorLeft = x;
|
|
||||||
Console.Write(tmp1);
|
|
||||||
}
|
|
||||||
Console.WriteLine();
|
|
||||||
Console.CursorLeft = 0;
|
|
||||||
}
|
|
||||||
Console.ForegroundColor = fCol;
|
|
||||||
Console.BackgroundColor = bCol;
|
|
||||||
_last = Screen;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Redraws the entire screen (should be done from time to time to prevent corruption)
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="color">Whether to use color</param>
|
|
||||||
public static void FullDraw(bool color)
|
|
||||||
{
|
|
||||||
Console.CursorTop = 0;
|
|
||||||
Console.CursorLeft = 0;
|
|
||||||
ConsoleColor fcol = Console.ForegroundColor;
|
|
||||||
ConsoleColor bcol = Console.BackgroundColor;
|
|
||||||
Console.Clear();
|
|
||||||
int width = Width;
|
int width = Width;
|
||||||
int height = Height;
|
int height = Height;
|
||||||
for (int y = 0; y < height; y++)
|
for (int y = 0; y < height; y++)
|
||||||
|
@ -76,6 +41,7 @@ namespace CC_Functions.Commandline.TUI
|
||||||
for (int x = 0; x < width; x++)
|
for (int x = 0; x < width; x++)
|
||||||
{
|
{
|
||||||
Pixel? tmp1 = Screen[y, x];
|
Pixel? tmp1 = Screen[y, x];
|
||||||
|
if (full && tmp1 == _last[y, x]) continue;
|
||||||
if (tmp1 != null && color)
|
if (tmp1 != null && color)
|
||||||
{
|
{
|
||||||
if (Console.ForegroundColor != tmp1.ForeColor)
|
if (Console.ForegroundColor != tmp1.ForeColor)
|
||||||
|
@ -89,8 +55,8 @@ namespace CC_Functions.Commandline.TUI
|
||||||
Console.WriteLine();
|
Console.WriteLine();
|
||||||
Console.CursorLeft = 0;
|
Console.CursorLeft = 0;
|
||||||
}
|
}
|
||||||
Console.ForegroundColor = fcol;
|
Console.ForegroundColor = fCol;
|
||||||
Console.BackgroundColor = bcol;
|
Console.BackgroundColor = bCol;
|
||||||
_last = Screen;
|
_last = Screen;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Reference in New Issue