Test simple render conveyer.
This commit is contained in:
parent
cabf659514
commit
a7fbf6ad7d
14
Domain/BigFrameLayerRenderResult.cs
Normal file
14
Domain/BigFrameLayerRenderResult.cs
Normal file
@ -0,0 +1,14 @@
|
||||
using Domain.Abstractions;
|
||||
|
||||
namespace Domain;
|
||||
|
||||
public class FramePartRenderResult
|
||||
{
|
||||
public uint Row { get; set; }
|
||||
public uint Column { get; set; }
|
||||
public uint FrameSizeX { get; set; }
|
||||
public uint FrameSizeY { get; set; }
|
||||
// или пиксели?
|
||||
|
||||
public string Frame { get; set; }
|
||||
}
|
||||
0
Domain/ConcreteLayers/Layer1.cs
Normal file
0
Domain/ConcreteLayers/Layer1.cs
Normal file
77
Domain/ConsoleImageDrawer.cs
Normal file
77
Domain/ConsoleImageDrawer.cs
Normal file
@ -0,0 +1,77 @@
|
||||
using System;
|
||||
namespace Domain;
|
||||
|
||||
public class ConsoleImageDrawer
|
||||
{
|
||||
private char[,]? _image; // Изображение хранится внутри класса
|
||||
|
||||
// 1. Нарисовать изображение
|
||||
public void DrawImage(char[,] image)
|
||||
{
|
||||
Console.Clear();
|
||||
_image = image;
|
||||
for (int i = 0; i < _image.GetLength(0); i++)
|
||||
{
|
||||
for (int j = 0; j < _image.GetLength(1); j++)
|
||||
{
|
||||
Console.SetCursorPosition(j, i);
|
||||
Console.Write(_image[i, j]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 2. Заменить фон в указанной области на цвет
|
||||
public void SetBackgroundColor(int startRow, int startCol, int height, int width, ConsoleColor color)
|
||||
{
|
||||
if (_image == null)
|
||||
{
|
||||
Console.Clear();
|
||||
Console.ForegroundColor = ConsoleColor.Red;
|
||||
Console.WriteLine("Image is not set");
|
||||
Console.ForegroundColor = ConsoleColor.Black;
|
||||
return;
|
||||
}
|
||||
Console.BackgroundColor = color;
|
||||
for (int i = startRow; i < Math.Min(startRow + height, _image.GetLength(0)); i++)
|
||||
{
|
||||
for (int j = startCol; j < Math.Min(startCol + width, _image.GetLength(1)); j++)
|
||||
{
|
||||
Console.SetCursorPosition(j, i);
|
||||
Console.Write(_image[i, j]);
|
||||
}
|
||||
}
|
||||
Console.ResetColor(); // Сброс цвета
|
||||
}
|
||||
|
||||
// 3. Отменить фон (вернуть черный)
|
||||
public void ResetBackgroundColor(int startRow, int startCol, int height, int width)
|
||||
{
|
||||
SetBackgroundColor(startRow, startCol, height, width, ConsoleColor.Black);
|
||||
}
|
||||
|
||||
// 4. Изменить цвет указанного символа
|
||||
public void SetCharacterColor(int row, int col, ConsoleColor foregroundColor)
|
||||
{
|
||||
if (_image == null)
|
||||
{
|
||||
Console.Clear();
|
||||
Console.ForegroundColor = ConsoleColor.Red;
|
||||
Console.WriteLine("Image is not set");
|
||||
Console.ForegroundColor = ConsoleColor.Black;
|
||||
return;
|
||||
}
|
||||
if (row >= 0 && row < _image.GetLength(0) && col >= 0 && col < _image.GetLength(1))
|
||||
{
|
||||
Console.SetCursorPosition(col, row);
|
||||
Console.ForegroundColor = foregroundColor;
|
||||
Console.Write(_image[row, col]);
|
||||
Console.ResetColor(); // Сброс цвета
|
||||
}
|
||||
}
|
||||
|
||||
// 5. Стереть изображение
|
||||
public void ClearImage()
|
||||
{
|
||||
Console.Clear();
|
||||
}
|
||||
}
|
||||
0
Domain/RenderConveyerBelt.cs
Normal file
0
Domain/RenderConveyerBelt.cs
Normal file
6
Domain/RenderResult.cs
Normal file
6
Domain/RenderResult.cs
Normal file
@ -0,0 +1,6 @@
|
||||
namespace Domain.Abstractions;
|
||||
|
||||
public class RenderResult
|
||||
{
|
||||
public List<>
|
||||
}
|
||||
26
Make3.Renderer/test1.txt
Normal file
26
Make3.Renderer/test1.txt
Normal file
@ -0,0 +1,26 @@
|
||||
|
||||
|
||||
|
||||
|
||||
.:^. ::.
|
||||
.:~77??: !??7!^:
|
||||
:!7??????: !??????7~.
|
||||
:7?????????: !?????????~.
|
||||
.!???????????: !???????????^
|
||||
.7????????????: !????????????~
|
||||
.7?????????????: !?????????????~
|
||||
!??????????????: !??????????????:
|
||||
.???????????????: !??????????????!
|
||||
^???????????????: !??????????????7
|
||||
:???????????????~ .7??????????????7
|
||||
.????????????????~. .:7???????????????!
|
||||
~?????????????????77!7??????????????????.
|
||||
7?????????????????????????????????????^
|
||||
.7J??????????????????????????????????^
|
||||
~?J?????????????????????????????J7:
|
||||
.!?JJ???????????????????????JJ7^
|
||||
.~7?JJJ???????????????JJJ?!:
|
||||
.^!7???JJJJJJJJ????7~:.
|
||||
..:^^~~~~~^^:.
|
||||
|
||||
|
||||
0
Make3.Renderer/test2-mask.txt
Normal file
0
Make3.Renderer/test2-mask.txt
Normal file
0
Make3.Renderer/test2.txt
Normal file
0
Make3.Renderer/test2.txt
Normal file
Loading…
Reference in New Issue
Block a user