From b58ec4dd8ce2d23e7e7b205f3823fd7bcea22a8a Mon Sep 17 00:00:00 2001 From: Chris Tacke Date: Fri, 16 Feb 2024 11:55:06 -0600 Subject: [PATCH] Add color parameter to WriteLine --- .../Driver/MicroGraphics.TextDisplay.cs | 19 ++++++++++++++++--- .../ImageLoadSample/meadow.config.yaml | 2 -- 2 files changed, 16 insertions(+), 5 deletions(-) delete mode 100644 Source/Meadow.Foundation.Libraries_and_Frameworks/Graphics.MicroGraphics/Samples/ImageLoadSample/meadow.config.yaml diff --git a/Source/Meadow.Foundation.Libraries_and_Frameworks/Graphics.MicroGraphics/Driver/MicroGraphics.TextDisplay.cs b/Source/Meadow.Foundation.Libraries_and_Frameworks/Graphics.MicroGraphics/Driver/MicroGraphics.TextDisplay.cs index 12e2d8487e..b5cb9eb08a 100644 --- a/Source/Meadow.Foundation.Libraries_and_Frameworks/Graphics.MicroGraphics/Driver/MicroGraphics.TextDisplay.cs +++ b/Source/Meadow.Foundation.Libraries_and_Frameworks/Graphics.MicroGraphics/Driver/MicroGraphics.TextDisplay.cs @@ -24,20 +24,33 @@ public void Write(string text) } /// - /// Write a line of text + /// Write a line of text in White /// /// The text /// The line to write /// True to show the cursor /// Throws if no font is set public void WriteLine(string text, byte lineNumber, bool showCursor = false) + { + WriteLine(text, lineNumber, Color.White, showCursor); + } + + /// + /// Write a line of text + /// + /// The text + /// The line to write + /// True to show the cursor + /// Optional color to use for drawing the text + /// Throws if no font is set + 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) { @@ -45,7 +58,7 @@ public void WriteLine(string text, byte lineNumber, bool showCursor = false) } } - void DrawCursor() + private void DrawCursor() { if (currentFont != null) { diff --git a/Source/Meadow.Foundation.Libraries_and_Frameworks/Graphics.MicroGraphics/Samples/ImageLoadSample/meadow.config.yaml b/Source/Meadow.Foundation.Libraries_and_Frameworks/Graphics.MicroGraphics/Samples/ImageLoadSample/meadow.config.yaml deleted file mode 100644 index 32363cb69c..0000000000 --- a/Source/Meadow.Foundation.Libraries_and_Frameworks/Graphics.MicroGraphics/Samples/ImageLoadSample/meadow.config.yaml +++ /dev/null @@ -1,2 +0,0 @@ -MonoControl: - Options: --jit \ No newline at end of file