mouse cursor
This commit is contained in:
@@ -51,6 +51,33 @@ void BasicRenderer::Print(const char* str) {
|
||||
}
|
||||
}
|
||||
|
||||
void BasicRenderer::PutPixel(uint32_t x, uint32_t y, uint32_t colour) {
|
||||
|
||||
*(uint32_t*)((uint64_t)targetFramebuffer->BaseAddress + (x*4) + (y * targetFramebuffer->PixelsPerScanline * 4)) = colour;
|
||||
|
||||
}
|
||||
|
||||
void BasicRenderer::DrawOverlayMouseCursor(uint8_t* mouseCursor, Point position, uint32_t colour) {
|
||||
int xMax = 16;
|
||||
int yMax = 19;
|
||||
int diffX = targetFramebuffer->Width - position.x;
|
||||
int diffY = targetFramebuffer->Height - position.y;
|
||||
|
||||
if (diffX < 16) xMax = diffX;
|
||||
if (diffY < 19) yMax = diffY;
|
||||
|
||||
for (int y = 0; y < yMax; y++) {
|
||||
for (int x = 0; x < xMax; x++) {
|
||||
int bit = y * 16 + x;
|
||||
int byte = bit / 8;
|
||||
|
||||
if (mouseCursor[byte] & (0b10000000 >> (x % 8))) {
|
||||
PutPixel(position.x + x, position.y + y, colour);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void BasicRenderer::Clear() {
|
||||
uint64_t fbBase = (uint64_t)targetFramebuffer->BaseAddress;
|
||||
uint64_t bytesPerScanline = targetFramebuffer->PixelsPerScanline * 4;
|
||||
|
||||
Reference in New Issue
Block a user