Add PrintString()

This commit is contained in:
EnderIce2 2024-02-15 22:53:39 +02:00
parent 9ab246f8c4
commit 69aeb5c36a
Signed by untrusted user who does not match committer: enderice2
GPG Key ID: EACC3AD603BAB4DD
2 changed files with 21 additions and 3 deletions

View File

@ -35,7 +35,9 @@ namespace Video
// std::fill(this->DirtyMap.begin(), this->DirtyMap.end(), true);
}
__no_sanitize("undefined") void Display::SetPixel(uint32_t X, uint32_t Y, uint32_t Color)
__no_sanitize("undefined") void Display::SetPixel(uint32_t X,
uint32_t Y,
uint32_t Color)
{
if (unlikely(X >= this->Width))
X = this->Width - 1;
@ -68,7 +70,9 @@ namespace Video
}
}
__no_sanitize("undefined") char Display::Print(char Char, Video::Font *_Font, bool WriteToUART)
__no_sanitize("undefined") char Display::Print(char Char,
Video::Font *_Font,
bool WriteToUART)
{
// SmartLock(PrintLock);
@ -248,6 +252,14 @@ namespace Video
return Char;
}
void Display::PrintString(const char *String,
Video::Font *Font,
bool WriteToUART)
{
for (size_t i = 0; String[i] != '\0'; ++i)
Print(String[i], Font, WriteToUART);
}
void Display::UpdateBuffer()
{
if (!DirectWrite)
@ -314,7 +326,9 @@ namespace Video
DirtyMap[index] = true;
}
Display::Display(BootInfo::FramebufferInfo Info, bool LoadDefaultFont, bool _DirectWrite)
Display::Display(BootInfo::FramebufferInfo Info,
bool LoadDefaultFont,
bool _DirectWrite)
: framebuffer(Info), DirectWrite(_DirectWrite)
{
Width = Info.Width;

View File

@ -240,6 +240,10 @@ namespace Video
Video::Font *Font = nullptr,
bool WriteToUART = false);
void PrintString(const char *String,
Video::Font *Font = nullptr,
bool WriteToUART = false);
Display(BootInfo::FramebufferInfo Info,
bool LoadDefaultFont = true,
bool DirectWrite = true);