Skip to content

Commit

Permalink
Merge pull request #905 from WildernessLabs/feature/WriteLine-color
Browse files Browse the repository at this point in the history
Add color parameter to WriteLine
  • Loading branch information
adrianstevens authored Feb 20, 2024
2 parents 3f7d6e9 + b58ec4d commit c8bca57
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,28 +24,41 @@ public void Write(string text)
}

/// <summary>
/// Write a line of text
/// Write a line of text in White
/// </summary>
/// <param name="text">The text</param>
/// <param name="lineNumber">The line to write</param>
/// <param name="showCursor">True to show the cursor</param>
/// <exception cref="Exception">Throws if no font is set</exception>
public void WriteLine(string text, byte lineNumber, bool showCursor = false)
{
WriteLine(text, lineNumber, Color.White, showCursor);
}

/// <summary>
/// Write a line of text
/// </summary>
/// <param name="text">The text</param>
/// <param name="lineNumber">The line to write</param>
/// <param name="showCursor">True to show the cursor</param>
/// <param name="textColor">Optional color to use for drawing the text</param>
/// <exception cref="Exception">Throws if no font is set</exception>
public void WriteLine(string text, byte lineNumber, Color textColor, bool showCursor = false)
{
if (CurrentFont == null)
{
throw new Exception("MicroGraphics.WriteLine requires CurrentFont to be set");
}
DrawText(0, lineNumber * CurrentFont.Height * DisplayConfig.FontScale,
text, Color.White, (ScaleFactor)DisplayConfig.FontScale);
text, textColor, (ScaleFactor)DisplayConfig.FontScale);

if (CursorLine == lineNumber && showCursor == true)
{
DrawCursor();
}
}

void DrawCursor()
private void DrawCursor()
{
if (currentFont != null)
{
Expand Down

This file was deleted.

0 comments on commit c8bca57

Please sign in to comment.