Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add color parameter to WriteLine #905

Merged
merged 1 commit into from
Feb 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.

Loading