Decorators and mirrors

A glyph can be decorated with additional glyphs layered on top, and each glyph can also be mirrored (flipped) either horizontally, vertically or not at all.

Mirroring a cell

var console = Game.Instance.StartingConsole;
console.FontSize = console.Font.GetFontSize(IFont.Sizes.Three);
var coloredGlyph = console.Surface[0, 0];
coloredGlyph.Glyph = 'P';
coloredGlyph.Foreground = Color.Cyan;
// By default it uses Mirror.None;
coloredGlyph.Mirror = Mirror.Horizontal;
coloredGlyph.IsDirty = true;

Another way to set a mirror on a cell is using the Surface:

console.Surface.SetMirror(0, 0, Mirror.Horizontal);

‘P’ horizontally mirrored:

‘P’ vertically mirrored:

Decorators

Decorators are basically glyphs on top of the cell glyph, you can easily layer visuals on top without having to define multiple consoles.

var console = Game.Instance.StartingConsole;
// Increasee the size so we can see it better
console.FontSize = console.Font.GetFontSize(IFont.Sizes.Three);
var coloredGlyph = console.Surface[0, 0];
coloredGlyph.Glyph = '=';
coloredGlyph.Foreground = Color.Red;

console.SetDecorator(new Point(0, 0), new CellDecorator(Color.Blue, '+', Mirror.None));

coloredGlyph.IsDirty = true;

Some examples come to mind, you loot a chest, and some coins drop on the metal floor underneath, you can use decorators to make them visible on top of the metal floor.

Thats it for decorators and mirrors!

Leave a comment

Design a site like this with WordPress.com
Get started