using System;
using Graph;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Graph
{
class graph
{
class ColorEl
{
public ColorEl(int x, int y, ConsoleColor b, ConsoleColor f, string txt){
Console.BackgroundColor = b;
Console.ForegroundColor = f;
Console.SetCursorPosition(x, y);
Console.WriteLine(txt);
Console.ResetColor();
}
}
public static void Main(string[] args)
{
ColorEl el1 = new ColorEl(12, 3, ConsoleColor.White, ConsoleColor.Black, "Drawing");
Console.WriteLine("\n\n\nНажмите любой символ для продолжения...");
Console.ReadKey();
Console.Clear();
Random rand = new Random();
int redo = 0;
int height = 10;
int sides = 20;
ConsoleKeyInfo keyinf;
Console.ForegroundColor = ConsoleColor.Cyan;
do
{
keyinf = Console.ReadKey(true);
switch(keyinf.Key){
case ConsoleKey.RightArrow:
sides++;
Console.SetCursorPosition(sides, height);
Console.WriteLine("▀");
break;
case ConsoleKey.LeftArrow:
sides--;
Console.SetCursorPosition(sides, height);
Console.WriteLine("▀");
break;
case ConsoleKey.UpArrow:
height--;
Console.SetCursorPosition(sides, height);
Console.WriteLine("▀");
break;
case ConsoleKey.DownArrow:
height++;
Console.SetCursorPosition(sides, height);
Console.WriteLine("▀");
break;
case ConsoleKey.Escape:
redo = 12;
Console.Clear();
Console.WriteLine("Рисование закончено");
break;
case ConsoleKey.R:
redo = 0;
break;
}
}while(redo == 0);
Console.ReadKey();
}
}
P.S. Переписан вопрос (простите, дописал, что бы было прям точно ясно, что я хочу узнать) Хочу сделать управление объектом, как реализовать? Я сам уже много что пробовал, искал, писал. Не могу найти нормально решения. Если есть уже примеры. Был бы рад посмотреть.