mirror of
https://github.com/Fennix-Project/Kernel.git
synced 2025-05-28 15:34:33 +00:00
Added DrawString in Display
This commit is contained in:
parent
18f05c6d83
commit
c0a3d3dd24
@ -160,6 +160,15 @@ namespace Video
|
|||||||
return Char;
|
return Char;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Display::DrawString(const char *String, uint32_t X, uint32_t Y, int Index, bool WriteToUART)
|
||||||
|
{
|
||||||
|
this->Buffers[Index]->CursorX = X;
|
||||||
|
this->Buffers[Index]->CursorY = Y;
|
||||||
|
|
||||||
|
for (int i = 0; String[i] != '\0'; i++)
|
||||||
|
this->Print(String[i], Index, WriteToUART);
|
||||||
|
}
|
||||||
|
|
||||||
Display::Display(BootInfo::FramebufferInfo Info, bool LoadDefaultFont)
|
Display::Display(BootInfo::FramebufferInfo Info, bool LoadDefaultFont)
|
||||||
{
|
{
|
||||||
this->framebuffer = Info;
|
this->framebuffer = Info;
|
||||||
|
@ -154,19 +154,19 @@ namespace Video
|
|||||||
*Y = this->Buffers[Index]->CursorY;
|
*Y = this->Buffers[Index]->CursorY;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SetPixel(uint32_t X, uint32_t Y, uint32_t Color, int Index)
|
inline void SetPixel(uint32_t X, uint32_t Y, uint32_t Color, int Index)
|
||||||
{
|
{
|
||||||
if (X >= this->Buffers[Index]->Width)
|
if (unlikely(X >= this->Buffers[Index]->Width))
|
||||||
X = this->Buffers[Index]->Width - 1;
|
X = this->Buffers[Index]->Width - 1;
|
||||||
if (Y >= this->Buffers[Index]->Height)
|
if (unlikely(Y >= this->Buffers[Index]->Height))
|
||||||
Y = this->Buffers[Index]->Height - 1;
|
Y = this->Buffers[Index]->Height - 1;
|
||||||
uint32_t *Pixel = (uint32_t *)((uintptr_t)this->Buffers[Index]->Buffer + (Y * this->Buffers[Index]->Width + X) * (this->framebuffer.BitsPerPixel / 8));
|
uint32_t *Pixel = (uint32_t *)((uintptr_t)this->Buffers[Index]->Buffer + (Y * this->Buffers[Index]->Width + X) * (this->framebuffer.BitsPerPixel / 8));
|
||||||
*Pixel = Color;
|
*Pixel = Color;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t GetPixel(uint32_t X, uint32_t Y, int Index)
|
inline uint32_t GetPixel(uint32_t X, uint32_t Y, int Index)
|
||||||
{
|
{
|
||||||
if (X >= this->Buffers[Index]->Width || Y >= this->Buffers[Index]->Height)
|
if (unlikely(X >= this->Buffers[Index]->Width || Y >= this->Buffers[Index]->Height))
|
||||||
return 0;
|
return 0;
|
||||||
uint32_t *Pixel = (uint32_t *)((uintptr_t)this->Buffers[Index]->Buffer + (Y * this->Buffers[Index]->Width + X) * (this->framebuffer.BitsPerPixel / 8));
|
uint32_t *Pixel = (uint32_t *)((uintptr_t)this->Buffers[Index]->Buffer + (Y * this->Buffers[Index]->Width + X) * (this->framebuffer.BitsPerPixel / 8));
|
||||||
return *Pixel;
|
return *Pixel;
|
||||||
@ -193,6 +193,7 @@ namespace Video
|
|||||||
}
|
}
|
||||||
|
|
||||||
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);
|
||||||
Display(BootInfo::FramebufferInfo Info, bool LoadDefaultFont = true);
|
Display(BootInfo::FramebufferInfo Info, bool LoadDefaultFont = true);
|
||||||
~Display();
|
~Display();
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user