namespace Terminus;
using System.Text;
///
/// A key pressed on the keyboard.
///
[StructLayout(LayoutKind.Sequential)]
public struct KeyPress
{
///
/// The value of the key that was pressed.
///
public uint Key;
///
/// The key modifier pressed (ctrl, alt, etc.)
///
public ushort Modifier;
///
/// The Unicode scalar of the key being pressed.
///
public uint Character;
///
/// Convert the key press to a .
///
public Rune ToRune()
{
return new Rune(Character);
}
///
/// Convert the key press to a string, with a conversion to as an intermediary.
///
public override string ToString()
{
return ToRune().ToString();
}
///
public static implicit operator Rune(KeyPress k)
{
return new Rune(k.Character);
}
///
public static implicit operator Cell(KeyPress k)
{
return new Cell(k.Character, Color.White, Color.Black, Style.Normal);
}
}