コード例 #1
0
    /// <summary>
    /// Displays a string on the display.  Is tied to an aligned grid 4px wide by 8px tall, per original LEM1802 spec.
    /// </summary>
    /// <param name="data">The buffer that is being manipulated.</param>
    /// <param name="x">The X coordinate of where to begin rendering the string.</param>
    /// <param name="y">The Y coordinate of where to begin rendering the string.</param>
    /// <param name="s">The string to render.</param>
    /// <param name="foreground">The color to use for the positive space (pixels the character fills).</param>
    /// <param name="background">The color to use for the negative space (pixels the character doesn't fill.</param>
    public static void WriteStr(this ScreenBufferState data, int x, int y, string s, ColorCode foreground, ColorCode background)
    {
        for (int i = 0; i < s.Length; i++)
        {
            if (x * 4 >= data.size.x)
            {
                y++;
                x = 0;
            }

            if (y * 8 >= data.size.y)
            {
                y = 0;
            }

            data.WriteChar(x, y, s[i], foreground, background);
            x++;
        }
    }
コード例 #2
0
 /// <summary>
 /// Displays a character on the display. Is tied to an aligned grid 4px wide by 8px tall, per original LEM1802 spec.
 /// </summary>
 /// <remarks>
 /// This is just a helper method for the version of WriteChar that uses a byte.
 /// </remarks>
 /// <param name="data">The buffer that is being manipulated.</param>
 /// <param name="x">The X coordinate of where to render the character.</param>
 /// <param name="y">The Y coordinate of where to render the character.</param>
 /// <param name="c">Which character to render.</param>
 /// <param name="foreground">The color to use for the positive space (pixels the character fills).</param>
 /// <param name="background">The color to use for the negative space (pixels the character doesn't fill.</param>
 public static void WriteChar(this ScreenBufferState data, int x, int y, char c, ColorCode foreground, ColorCode background)
 {
     data.WriteChar(x, y, characterToByte[c], foreground, background);
 }
コード例 #3
0
 /// <summary>
 /// Displays a character on the display. Is tied to an aligned grid 4px wide by 8px tall, per original LEM1802 spec.
 /// </summary>
 /// <remarks>
 /// This utilizes the default font set of the LEM1802; manual pixel control is available from the SetPixel call.
 /// This code presumes that a display's resolution can be evenly divided into 4px w by 8 px h cells.
 /// Original font ripped from https://rdr4g0n.github.io/0x10c_SpriteStudio/.
 /// </remarks>
 /// <param name="data">The buffer that is being manipulated.</param>
 /// <param name="x">The X coordinate of where to render the character.</param>
 /// <param name="y">The Y coordinate of where to render the character.</param>
 /// <param name="c">The index of the character to render.</param>
 /// <param name="foreground">The color to use for the positive space (pixels the character fills).</param>
 /// <param name="background">The color to use for the negative space (pixels the character doesn't fill.</param>
 public static void WriteChar(this ScreenBufferState data, int x, int y, byte characterIndex, ColorCode foreground, ColorCode background)
 {
     // Fill character based on c
     // Just pulls a specific index from a constant array filled (by hand!) from linked source
     data.WriteChar(x, y, characterData[characterIndex], foreground, background);
 }