-
Notifications
You must be signed in to change notification settings - Fork 121
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #269 from Thraka/develop
Release for 9.1.0
- Loading branch information
Showing
60 changed files
with
963 additions
and
351 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,96 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using Newtonsoft.Json; | ||
using SadRogue.Primitives; | ||
|
||
namespace SadConsole | ||
{ | ||
/// <summary> | ||
/// A <see cref="ColoredGlyph"/> with state information. | ||
/// </summary> | ||
public readonly struct ColoredGlyphState | ||
{ | ||
/// <summary> | ||
/// A copy of the <see cref="ColoredGlyph.Decorators"/> property. | ||
/// </summary> | ||
public CellDecorator[] Decorators { get; } | ||
|
||
/// <summary> | ||
/// A copy of the <see cref="ColoredGlyph.Foreground"/> property. | ||
/// </summary> | ||
public Color Foreground { get; } | ||
|
||
/// <summary> | ||
/// A copy of the <see cref="ColoredGlyph.Background"/> property. | ||
/// </summary> | ||
public Color Background { get; } | ||
|
||
/// <summary> | ||
/// A copy of the <see cref="ColoredGlyph.Glyph"/> property. | ||
/// </summary> | ||
public int Glyph { get; } | ||
|
||
/// <summary> | ||
/// A copy of the <see cref="ColoredGlyph.Mirror"/> property. | ||
/// </summary> | ||
public Mirror Mirror { get; } | ||
|
||
/// <summary> | ||
/// A copy of the <see cref="ColoredGlyph.IsVisible"/> property. | ||
/// </summary> | ||
public bool IsVisible { get; } | ||
|
||
/// <summary> | ||
/// Creates a new state from a cell. | ||
/// </summary> | ||
/// <param name="cell">The colored glyph this state is a copy of.</param> | ||
public ColoredGlyphState(ColoredGlyph cell) | ||
{ | ||
Foreground = cell.Foreground; | ||
Background = cell.Background; | ||
Mirror = cell.Mirror; | ||
Glyph = cell.Glyph; | ||
IsVisible = cell.IsVisible; | ||
Decorators = cell.Decorators.Length != 0 ? cell.Decorators.ToArray() : Array.Empty<CellDecorator>(); | ||
} | ||
|
||
/// <summary> | ||
/// Creates a new state. | ||
/// </summary> | ||
/// <param name="decorators">Decorators for the cell.</param> | ||
/// <param name="foreground">Foreground color.</param> | ||
/// <param name="background">Background color.</param> | ||
/// <param name="glyph">The glyph index.</param> | ||
/// <param name="mirror">The mirror effect.</param> | ||
/// <param name="isVisible">The visiblity of the glyph.</param> | ||
[JsonConstructor] | ||
public ColoredGlyphState(CellDecorator[] decorators, Color foreground, Color background, int glyph, Mirror mirror, bool isVisible) | ||
{ | ||
Decorators = decorators; | ||
Foreground = foreground; | ||
Background = background; | ||
Glyph = glyph; | ||
Mirror = mirror; | ||
IsVisible = isVisible; | ||
} | ||
|
||
/// <summary> | ||
/// Restores this state to the specified cell. | ||
/// </summary> | ||
public void RestoreState(ref ColoredGlyph cell) | ||
{ | ||
cell.Foreground = Foreground; | ||
cell.Background = Background; | ||
cell.Mirror = Mirror; | ||
cell.Glyph = Glyph; | ||
cell.IsVisible = IsVisible; | ||
|
||
if (Decorators == null) | ||
cell.Decorators = Array.Empty<CellDecorator>(); | ||
else | ||
cell.Decorators = Decorators.Length != 0 ? Decorators.ToArray() : Array.Empty<CellDecorator>(); | ||
} | ||
} | ||
} |
Oops, something went wrong.