.
This commit is contained in:
@@ -19,4 +19,4 @@ public enum Align
|
||||
/// Align content to the right.
|
||||
/// </summary>
|
||||
Right
|
||||
}
|
||||
}
|
||||
@@ -43,7 +43,6 @@
|
||||
<AutoGen>True</AutoGen>
|
||||
<DependentUpon>ShaderResource.resx</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Remove="src\Resource\ResourceHandle.cs" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
||||
@@ -15,17 +15,17 @@ public interface IPresenter : IUpdate, IRender
|
||||
public event Action<ResizeEventArgs> OnResize;
|
||||
|
||||
/// <summary>
|
||||
/// Gets the current width of the presenter.
|
||||
/// The current width of the presenter.
|
||||
/// </summary>
|
||||
public int Width { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the current height of the presenter.
|
||||
/// The current height of the presenter.
|
||||
/// </summary>
|
||||
public int Height { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets a value indicating whether the presenter is exiting.
|
||||
/// Indicates whether the presenter is exiting.
|
||||
/// </summary>
|
||||
public bool IsExiting { get; }
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@ public struct AsciiPixel : IPixel
|
||||
public SizedInternalFormat SizedInternalFormat => SizedInternalFormat.Rg8;
|
||||
|
||||
public byte Luminance => R;
|
||||
public byte Color => G;
|
||||
public byte NormalizedColorIndex => G;
|
||||
|
||||
public byte R;
|
||||
public byte G;
|
||||
|
||||
@@ -16,7 +16,6 @@ public sealed class ConsoleFastOutput : IDisposable
|
||||
private int _height;
|
||||
private int _width;
|
||||
|
||||
|
||||
public ConsoleFastOutput(int parWidth, int parHeight)
|
||||
{
|
||||
ArgumentOutOfRangeException.ThrowIfNegativeOrZero(parWidth);
|
||||
@@ -30,7 +29,11 @@ public sealed class ConsoleFastOutput : IDisposable
|
||||
throw new InvalidOperationException("Failed to open console handle");
|
||||
}
|
||||
|
||||
Resize(parWidth, parHeight);
|
||||
_width = parWidth;
|
||||
_height = parHeight;
|
||||
|
||||
_buffer = new WindowsFFI.CharInfo[_width * _height];
|
||||
_bufferSize = new WindowsFFI.Coord((short)_width, (short)_height);
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
@@ -38,6 +41,7 @@ public sealed class ConsoleFastOutput : IDisposable
|
||||
{
|
||||
var index = parX + (parY * _width);
|
||||
ref var charInfo = ref _buffer[index];
|
||||
|
||||
charInfo.Char.UnicodeChar = parCharacter;
|
||||
charInfo.Attributes = (short)((ushort)parForeground | ((ushort)parBackground << 4));
|
||||
}
|
||||
|
||||
@@ -128,7 +128,8 @@ public class ConsolePresenter : IPresenter
|
||||
{
|
||||
var pixel = parImage[y, x];
|
||||
var lightnessIndex = (byte)(pixel.Luminance / 255.0f * (LIGHTMAP.Length - 1));
|
||||
var colorIndex = (ConsoleColor)(pixel.Color / 255.0f * 15.0f);
|
||||
var colorIndex = (ConsoleColor)(pixel.NormalizedColorIndex / 255.0f * 15.0f);
|
||||
|
||||
_consoleOutput.WriteChar(LIGHTMAP[lightnessIndex], 2 * x, y, 0, colorIndex);
|
||||
_consoleOutput.WriteChar(LIGHTMAP[lightnessIndex], (2 * x) + 1, y, 0, colorIndex);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user