Add IgnoreSpecialChars parameter to Print and PrintString functions

This commit is contained in:
EnderIce2 2024-02-19 01:42:29 +02:00
parent 5adc4151a6
commit 495e75c649
Signed by untrusted user who does not match committer: enderice2
GPG Key ID: EACC3AD603BAB4DD
2 changed files with 16 additions and 7 deletions

View File

@ -72,7 +72,8 @@ namespace Video
__no_sanitize("undefined") char Display::Print(char Char, __no_sanitize("undefined") char Display::Print(char Char,
Video::Font *_Font, Video::Font *_Font,
bool WriteToUART) bool WriteToUART,
bool IgnoreSpecialChars)
{ {
// SmartLock(PrintLock); // SmartLock(PrintLock);
@ -102,6 +103,10 @@ namespace Video
if (_Font == nullptr) if (_Font == nullptr)
_Font = this->DefaultFont; _Font = this->DefaultFont;
this->CurrentFont = _Font; this->CurrentFont = _Font;
uint32_t FontHeight;
if (IgnoreSpecialChars)
goto IgnoreSpecialChars;
switch (Char) switch (Char)
{ {
@ -168,7 +173,8 @@ namespace Video
break; break;
} }
uint32_t FontHeight = this->GetCurrentFont()->GetInfo().Height; IgnoreSpecialChars:
FontHeight = this->GetCurrentFont()->GetInfo().Height;
if (this->CursorX + this->GetCurrentFont()->GetInfo().Width >= this->Width) if (this->CursorX + this->GetCurrentFont()->GetInfo().Width >= this->Width)
{ {
@ -254,10 +260,11 @@ namespace Video
void Display::PrintString(const char *String, void Display::PrintString(const char *String,
Video::Font *Font, Video::Font *Font,
bool WriteToUART) bool WriteToUART,
bool IgnoreSpecialChars)
{ {
for (size_t i = 0; String[i] != '\0'; ++i) for (size_t i = 0; String[i] != '\0'; ++i)
Print(String[i], Font, WriteToUART); Print(String[i], Font, WriteToUART, IgnoreSpecialChars);
} }
void Display::UpdateBuffer() void Display::UpdateBuffer()

View File

@ -238,11 +238,13 @@ namespace Video
char Print(char Char, char Print(char Char,
Video::Font *Font = nullptr, Video::Font *Font = nullptr,
bool WriteToUART = false); bool WriteToUART = false,
bool IgnoreSpecialChars = false);
void PrintString(const char *String, void PrintString(const char *String,
Video::Font *Font = nullptr, Video::Font *Font = nullptr,
bool WriteToUART = false); bool WriteToUART = false,
bool IgnoreSpecialChars = false);
Display(BootInfo::FramebufferInfo Info, Display(BootInfo::FramebufferInfo Info,
bool LoadDefaultFont = true, bool LoadDefaultFont = true,