Add SetDoNotScroll

This commit is contained in:
Alex 2023-03-26 21:16:02 +03:00
parent ab64b9f3b0
commit c6da67a7a3
Signed by untrusted user who does not match committer: enderice2
GPG Key ID: EACC3AD603BAB4DD
3 changed files with 22 additions and 2 deletions

View File

@ -188,6 +188,9 @@ namespace Video
return; return;
} }
if (this->Buffers[Index].DoNotScroll)
return;
if (Lines == 0) if (Lines == 0)
return; return;
@ -201,6 +204,17 @@ namespace Video
} }
} }
void Display::SetDoNotScroll(bool Value, int Index)
{
if (unlikely(this->Buffers[Index].Checksum != 0xDEAD))
{
debug("Invalid buffer %d", Index);
return;
}
this->Buffers[Index].DoNotScroll = Value;
}
char Display::Print(char Char, int Index, bool WriteToUART) char Display::Print(char Char, int Index, bool WriteToUART)
{ {
if (unlikely(this->Buffers[Index].Checksum != 0xDEAD)) if (unlikely(this->Buffers[Index].Checksum != 0xDEAD))
@ -302,8 +316,11 @@ namespace Video
if (this->Buffers[Index].CursorY + FontHeight >= this->Buffers[Index].Height) if (this->Buffers[Index].CursorY + FontHeight >= this->Buffers[Index].Height)
{ {
this->Buffers[Index].CursorY -= FontHeight; if (!this->Buffers[Index].DoNotScroll)
this->Scroll(Index, 1); {
this->Buffers[Index].CursorY -= FontHeight;
this->Scroll(Index, 1);
}
} }
switch (this->CurrentFont->GetInfo().Type) switch (this->CurrentFont->GetInfo().Type)

View File

@ -224,6 +224,7 @@ EXTERNC NIF void Main(BootInfo *Info)
{ {
Display->CreateBuffer(0, 0, 1); Display->CreateBuffer(0, 0, 1);
Display->SetDoNotScroll(true, 1);
Video::ScreenBuffer *buf = Display->GetBuffer(1); Video::ScreenBuffer *buf = Display->GetBuffer(1);
Video::FontInfo fi = Display->GetCurrentFont()->GetInfo(); Video::FontInfo fi = Display->GetCurrentFont()->GetInfo();
Display->SetBufferCursor(1, 0, buf->Height - fi.Height); Display->SetBufferCursor(1, 0, buf->Height - fi.Height);

View File

@ -84,6 +84,7 @@ namespace Video
uint32_t Color; uint32_t Color;
uint32_t CursorX, CursorY; uint32_t CursorX, CursorY;
char Brightness; char Brightness;
bool DoNotScroll;
long Checksum; long Checksum;
}; };
@ -135,6 +136,7 @@ namespace Video
void SetPixel(uint32_t X, uint32_t Y, uint32_t Color, int Index); void SetPixel(uint32_t X, uint32_t Y, uint32_t Color, int Index);
uint32_t GetPixel(uint32_t X, uint32_t Y, int Index); uint32_t GetPixel(uint32_t X, uint32_t Y, int Index);
void Scroll(int Index, int Lines); void Scroll(int Index, int Lines);
void SetDoNotScroll(bool Value, int Index);
char Print(char Char, int Index, bool WriteToUART = false); char Print(char Char, int Index, bool WriteToUART = false);
void DrawString(const char *String, uint32_t X, uint32_t Y, int Index, bool WriteToUART = false); void DrawString(const char *String, uint32_t X, uint32_t Y, int Index, bool WriteToUART = false);